-
Notifications
You must be signed in to change notification settings - Fork 419
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
Segmentation fault with ruby-2.6.3 #808
Comments
Not sure if this should be a separate issue or not, but I'm here to report that it happens on Ruby 2.5.5p157 as well. Here's the trace:
|
After some testing it seems that this commit is the culprit: eb81fff "avoid "can't be called from trap context" errors in ThreadLocalVar". Reverting that commit fixes the problem. |
Thank you for reporting and finding out the commit, it is a big help. |
We're also seeing this problem with ruby-2.6.3. |
Same Problem here. |
I'll look into this as soon as possible. |
@pitr-ch Thank you. :) |
I do not have a reproducer, however, I've spotted potentially dangerous array access in the code which is fixed in #821, please try it and let me know if the issue goes away. Thanks. |
We were able to avoid the mistake and solved it differently. I still try to test the bugfix as fast as possible. |
Thank you @dmtask! |
For me, it works. |
I am getting segfaults and some of them show this:
I have a minimalistic Rails app that reproduces the problem, if that's helpful. I tried applying the patch above, but it does not seem to fix it. I just hand-edited in to version 1.1.5, so I don't know if that's sufficient. |
@pitr-ch ultimately I think there must be a bug in Ruby itself somewhere too. I don't know much about this code, but I can see user level code generating errors, exceptions, even deadlocking, but it should not segfault. |
Also encountering this problem with Ruby 2.6.0
It happens anytime I run an Activerecord call of any kind, no matter how simple, from within Our production and staging environments appear to be unaffected Are there any other parts of the log that would be helpful to see? |
Let me add one more example to the discussion :) as discussed here after upgrading rails 5.2 (on Ruby 2.6.3) to 6.0.0 (on Ruby 2.6.3) I started having this issue when running RSpec:
Now the funny thing is that when I've ugraded some of my other personal projects they don't have this issue. So it seems to be just when using some Gems. As @davidw pointed out in here it may be Mongoid + DatabaseCleaner (as I have same gems in my setups too) |
Still seeing the problem with: |
I think there's some kind of race condition going on. I added a Wild guess: something is getting GC'ed, then the thread tries to run and barfs. |
@pitr-ch what is the new thread for in those cleanup methods anyway? If I remove it, things work correctly, and all tests pass in the master branch. Is it some kind of optimization? |
I filed a Ruby bug here: https://bugs.ruby-lang.org/issues/16288 In this code, the thread in the finalizer won't run, because the main thread has already been marked as killed, so it can't start a thread:
|
I have similar error and created small sample app. Maybe it would be useful. https://github.com/mainameiz/segfault_app |
It mitigates the issue causing segfaults on Ruby 2.5 and 2.6: - ruby-concurrency/concurrent-ruby#808 [#698]
Hi @cesarizu @mwsteb @rubenfonseca @dmtask, I've came up with a different solution for this problem, it is in #856. Could you give it a try. I do not have a reproducer. Thanks! |
btw last week I've removed my temp solution mentioned here #808 (comment) went with latest gem version released on ruby-gems, all works great 👍 |
@pitr-ch I have a test app https://github.com/mainameiz/segfault_app. Your fix (#856) also works fine. |
Thanks for testing and the update! |
@pitr-ch We've started observing some issues with ThreadLocalVar since 1.1.7 on MRI when mutation testing with mutant (known for exercising MRI well). I did not manage to reproduce it on a contrived example although it has been repeating on CI and local mutation test runs.
|
Thanks @pawelpacana for the report! I think I see the issue, the assignment conflicts with the |
@pawelpacana pls verify #884 works. |
@pitr-ch I can confirm the fix working, thank you 🖤 |
@pawelpacana thanks for confirming |
[SIGSEGV]> ruby -- Control frame information ----------------------------------------------- -- Ruby level backtrace information ---------------------------------------- -- Other runtime information -----------------------------------------------
7f555000-7f556000 r-xp 00000000 fd:00 408298 /data/data/com.termux/files/usr/bin/ruby |
@rajnikantmahato why do you believe this is related? |
[BUG] Segmentation fault at 0x0000000000000440 |
still there, Rocky Linux 8, ruby 3.1.2p20 freshly compiled [BUG] transient_heap_block_alloc: failed ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux] -- Control frame information ----------------------------------------------- -- C level backtrace information ------------------------------------------- -- Other runtime information -----------------------------------------------
55f13c805000-55f13cbf8000 r-xp 00000000 08:01 420432 /usr/local/bin/ruby Aborted (core dumped) |
Ask around about this. |
The stacktraces since the last close of this issue look completely unrelated to concurrent-ruby. |
When updating an app to run with ruby 2.6.3 (from 2.4.4) I get the following error:
I tried using
Concurrent.use_stdlib_logger(Logger::DEBUG)
to get more information but nothing else is printed to the console. How can I start debugging this problem?The text was updated successfully, but these errors were encountered: