Skip to content

fix(crawler): clean up Playwright driver on __aenter__ failure (#2155) - #2197

Open
Battleplus wants to merge 1 commit into
unclecode:mainfrom
Battleplus:fix/2155-playwright-leak
Open

fix(crawler): clean up Playwright driver on __aenter__ failure (#2155)#2197
Battleplus wants to merge 1 commit into
unclecode:mainfrom
Battleplus:fix/2155-playwright-leak

Conversation

@Battleplus

Copy link
Copy Markdown

Summary

Fixes #2155 — When browser launch fails inside aenter, the exception propagated without closing the partially-initialized crawler, leaking a live 'node run-driver' child process. Each failed attempt grew the process count linearly.

Fix

Add try/except in aenter to call close() on failure before re-raising.

Files changed

  • crawl4ai/async_webcrawler.py (+11/-1)

…code#2155)

When browser launch fails inside __aenter__, the exception propagated
without closing the partially-initialized crawler, leaking a live
'node run-driver' child process. Each failed attempt grew the process
count linearly.

Add try/except in __aenter__ to call close() on failure before
re-raising.

Closes unclecode#2155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AsyncWebCrawler leaks Playwright driver process when browser startup fails in __aenter__

1 participant