lecture 2 of 160 completed

Driver lifecycle at scale

Sessions are resources you allocate and must release. At scale, leaks take down build machines and reuse causes cross-test bleed.

What you'll learn

  • Why leaked sessions take down build machines
  • How to guarantee cleanup on every path
  • How to reuse drivers without leaking state

A build server that has to be restarted every few days usually has a suite leaking a handful of browser processes per run. After a week there are hundreds, the machine has no memory left, and every job on it is slow.

That happens without anyone writing obviously wrong code. driver.quit() sits at the end of each test, and tests that fail never reach it.

At senior level, driver lifecycle is a resource management problem, and it has three parts: never leak, isolate correctly, and pay the startup cost as few times as you can.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →