Fixing headless Chrome timeouts requires cleanup, not just a longer deadline
A developer running an hourly job to mirror posts to Medium encountered repeated failures when headless Chrome, controlled via Playwright's connect_over_cdp, timed out during startup on a busy machine. Simply raising the timeout deadline from 15 to 45 seconds was only part of the solution. The deeper fix required calling a shutdown routine before retrying, because a failed Chrome launch leaves the process partially alive with the port bound and the user data directory locked. Retrying without first clearing that state results in an immediate connection refusal rather than a fresh start. The broader lesson is that recovering a singleton resource — such as a fixed port or locked directory — demands a clean teardown before any retry, not merely more waiting time.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in