Skip to content

gh-117688: Fix deadlock in test_no_stale_references with GIL disabled - #117720

Merged
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-117688-test_no_stale_references
Apr 15, 2024
Merged

gh-117688: Fix deadlock in test_no_stale_references with GIL disabled#117720
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-117688-test_no_stale_references

Conversation

@colesbury

@colesburycolesbury commented Apr 10, 2024

Copy link
Copy Markdown
Contributor

Check my_object_collected.wait() in a loop to give the main thread a
chance to merge the reference count fields. Additionally, call
my_object_collected.set() in a background thread to avoid deadlocking
when the destructor is called asynchronously via the eval breaker
within the body of of my_object_collected.wait().

@corona10

Copy link
Copy Markdown
Member

Oh, I will take a look at it by tomorrow :) I need to read the details.

@corona10corona10 self-assigned this Apr 11, 2024
@colesbury

Copy link
Copy Markdown
ContributorAuthor

Thanks!

@corona10corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,
It is a complicated situation, and I can not find a better solution.

@colesbury
colesbury merged commit 520cf21 into python:mainApr 15, 2024
@colesbury
colesbury deleted the gh-117688-test_no_stale_references branch April 15, 2024 16:54
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…sabled (python#117720)
Check `my_object_collected.wait()` in a loop to give the main thread a
chance to merge the reference count fields. Additionally, call
`my_object_collected.set()` in a background thread to avoid deadlocking
when the destructor is called asynchronously via the eval breaker
within the body of of `my_object_collected.wait()`.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dirtopic-free-threading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@colesbury@corona10