Skip to content

fix: close browser contexts from snapshot - #2003

Merged
ntohidi merged 1 commit into
unclecode:developfrom
nightcityblade:fix/issue-1999
Jun 28, 2026
Merged

ntohidi merged 1 commit into
unclecode:developfrom
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

@ntohidi
ntohidi changed the base branch from main to develop June 28, 2026 07:52
@ntohidi

ntohidi commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! The fix looks good — we've verified it locally and it resolves the issue.

One small note for future PRs: please target the develop branch instead of main. I've updated the base branch on this one already.

Thanks again!

@ntohidi
ntohidi merged commit e1ec743 into unclecode:develop Jun 28, 2026
1 check failed
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

2 participants