Overview
The Ghost in the Machine
Zombie processes (or 'Orphaned Processes') are the silent killers of stable test automation, especially in headless browser testing.
If an automation script crashes before reaching the driver.quit() command, the browser instance (Chrome/Firefox) may remain open in the background. Over multiple runs, these zombies accumulate, slowing down the test runner and causing 'flaky' timeouts.

Best Practices
Dos and Don'ts
Avoid common mistakes that can lead to flaky tests and maintenance nightmares.
What to do
- •Use 'try-finally' blocks or 'teardown' fixtures to ensure browsers always close.
- •Implement a 'cleanup' script in your CI pipeline to kill orphaned processes after each run.
- •Monitor the 'Process Table' on your automation agents periodically.
Common Pitfalls
- •Don't rely on the test runner to always clean up; hard crashes can bypass runner logic.
- •Don't run parallel tests without ensuring each process has a unique identifier.
The Details
Mitigating Zombie Processes in Docker
Modern QA teams use Docker to solve the zombie problem. By running tests inside a container and destroying the container immediately after the run, you ensure that every process—zombie or otherwise—is wiped from existence. This 'ephemeral agent' strategy is the most reliable way to maintain high-velocity automation without the technical debt of resource leakage.