Skip to content

Conversation

@daniel-sanche
Copy link
Contributor

Fixes #985 (comment)

When tearing down the background watcher thread, it would cause lock re-entry in the Watch._closing lock, which meant the thread would deadlock, and not be cleaned up properly.

This PR prevents on_snapshot messages from propagating when the Watch instance is in the process of closing down

@daniel-sanche daniel-sanche requested review from a team as code owners February 1, 2025 00:39
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Feb 1, 2025
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Feb 1, 2025
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Feb 21, 2025
@daniel-sanche daniel-sanche merged commit c47677a into main Feb 25, 2025
22 checks passed
@daniel-sanche daniel-sanche deleted the fix_watch_deadlock branch February 25, 2025 18:01
gkevinzheng pushed a commit that referenced this pull request Apr 30, 2025
* fix: fix thread cleanup when destroying Watch instance

* added test for on_snapshot while closing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the googleapis/python-firestore API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watch instances not getting garbage collected

3 participants