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: GC safety in Thread#start #14558

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ysbaddaden
Copy link
Contributor

Follow up to #14554 where a comment by @yxhuvud made me realize that Thread#start wasn't exactly GC safe, in that a GC collection could happen in parallel to a thread starting and it could free the Thread object before the thread is started or before the thread is properly shutdown.

The patch mostly moves the calls to add/remove the thread object from the linked list, along with some explanations.

Note: only the last commit is relevant, the rest is from #14554.

@ysbaddaden
Copy link
Contributor Author

ysbaddaden commented May 3, 2024

Interestingly that caused CI to segfault with -Dpreview_mt 🤨

Of course, no stacktrace and I can't reproduce.

ysbaddaden added a commit to ysbaddaden/execution_context that referenced this pull request May 6, 2024
ysbaddaden added a commit to ysbaddaden/execution_context that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

None yet

1 participant