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
Handle segfault in Ruby 2.6.6 on thread-locals #2567
Handle segfault in Ruby 2.6.6 on thread-locals #2567
Conversation
I'm not entirely sure how to test/document this or if we even need to tbh. Let me know what you think. |
@MSP-Greg tagging you since you commented on the issue |
@kddeisz I'm wondering if Since @nateberkopec did the original commit, and I'm not that familiar with "Rails' reaper thread", he should also review. |
So if I understand this correctly, Process::Waiter threads are created by Process.detach. I think we should clarify if this type of thread is always safe or is always unsafe to exist during |
I think either way the issue is calling |
If we can avoid it, I'd rather avoid the RUBY_VERSION check. So if it's always unsafe or always safe, we can simply exclude it and never need to call thread_local_variable_get on it for any ruby version. |
I think that's fine. I just have no idea how to tell if it's fork safe or not. |
OK, so the following needs to be tested: In a Ruby process, if you If true, that is definitely dangerous and could potentially break people's apps (especially in a |
@nateberkopec I think that's correct, so the logic should be good now as it includes waiters in the list of non-fork-safe threads. I've updated to remove the ruby version check. |
When you're trying to access a thread-local variable on Ruby < 2.7, and you call `thread_variable_get` on a `Process::Waiter` (a subclass of `Thread`), it will segfault. This adds a check for which Ruby version you're on to make it safe for Ruby 2.6. Fixes #2566.
Wunderbar! |
When you're trying to access a thread-local variable on Ruby < 2.7, and you call `thread_variable_get` on a `Process::Waiter` (a subclass of `Thread`), it will segfault. This adds a check for which Ruby version you're on to make it safe for Ruby 2.6. Fixes puma#2566.
When you're trying to access a thread-local variable on Ruby < 2.7, and you call
thread_variable_get
on aProcess::Waiter
(a subclass ofThread
), it will segfault. This adds a check for which Ruby version you're on to make it safe for Ruby 2.6.Closes #2566.
Your checklist for this pull request
[changelog skip]
or[ci skip]
to the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.