Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a deadlock involving scheduler.all_digests, and add a note. (cherrypick of #11723) #11726

Merged
merged 1 commit into from Mar 17, 2021

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Mar 17, 2021

Problem

By chance, a garbage collection thread started up and called lease_files_in_graph while I happened to be running Pants in the foreground. This caused a deadlock because lease_files_in_graph was not releasing the GIL before touching the Graph (via the Scheduler)... and foreground interactions with the Graph frequently need to acquire the GIL to check for equality.

Solution

Move the problematic call to scheduler.all_digests() under allow_threads and add a note. Additionally, move one other potentially-problematic method call under allow_threads.

Result

A rare (hopefully?) deadlock is prevented. See #11722 for how we might make this less likely in the future.

[ci skip-build-wheels]

…sbuild#11723)

### Problem

By chance, a garbage collection thread started up and called `lease_files_in_graph` while I happened to be running Pants in the foreground. This caused a deadlock because `lease_files_in_graph` was not releasing the GIL before touching the `Graph` (via the `Scheduler`)... and foreground interactions with the `Graph` frequently need to acquire the GIL to check for equality.

### Solution

Move the problematic call to `scheduler.all_digests()` under `allow_threads` and add a note. Additionally, move one other potentially-problematic method call under `allow_threads`.

### Result

A rare (hopefully?) deadlock is prevented. See pantsbuild#11722 for how we might make this less likely in the future.

[ci skip-build-wheels]
@stuhood stuhood merged commit c736f70 into pantsbuild:2.3.x Mar 17, 2021
@stuhood stuhood deleted the stuhood/pick-11723-for-2.3.x branch March 17, 2021 23:10
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.

None yet

3 participants