Skip to content

fix: close browser contexts from snapshot#2003

Open
nightcityblade wants to merge 1 commit into
unclecode:mainfrom
nightcityblade:fix/issue-1999
Open

fix: close browser contexts from snapshot#2003
nightcityblade wants to merge 1 commit into
unclecode:mainfrom
nightcityblade:fix/issue-1999

Conversation

@nightcityblade
Copy link
Copy Markdown
Contributor

Summary

Fixes #1999

Close browser contexts from a stable snapshot so shutdown is not interrupted if contexts_by_config changes while a context is being closed.

List of files changed and why

  • crawl4ai/browser_manager.py - Iterate over a snapshot of context values in BrowserManager close paths.
  • tests/browser/test_browser_manager_close.py - Add a regression test for context-map mutation during close.

How Has This Been Tested?

  • python -m pytest -q tests/browser/test_browser_manager_close.py

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added/updated unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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]: RuntimeError: dictionary changed size during iteration during AsyncWebCrawler shutdown

1 participant