Project

General

Profile

Actions

Bug #17584

closed

Segmentation fault with Ruby 3.0

Added by hsbt (Hiroshi SHIBATA) 10 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
[ruby-core:102254]

Description

In last week, I update Ruby 3.0 from Ruby 2.6.6 for my application. After that, I got the segmentation fault with following error.

[BUG] Segmentation fault at 0x0000000000000046
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Machine register context ------------------------------------------------
 RIP: 0x00007fddf4e032f7 RBP: 0x00007fddf10314e0 RSP: 0x00007fddf10313b0
 RAX: 0x0000000000000036 RBX: 0x0000000000000032 RCX: 0x0000000000000000
 RDX: 0x0000000000000001 RDI: 0x00007fddf1031cc0 RSI: 0x00007fddf4f47250
  R8: 0x0000000000000001  R9: 0x0000556a5d1fe6f0 R10: 0x0000556a5b9daf38
 R11: 0x0000556a5cba899a R12: 0x0000556a5d1fe6f0 R13: 0x0000000000000028
 R14: 0x0000000000000028 R15: 0x00007fddf4f846d4 EFL: 0x0000000000010246

-- C level backtrace information -------------------------------------------
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x11) [0x7fddf4f61773] vm_dump.c:758
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal+0x162) [0x7fddf4d6dc72] error.c:786
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x4d) [0x7fddf4eb893d] signal.c:960
/lib/x86_64-linux-gnu/libc.so.6(0x7fddf4aeb210) [0x7fddf4aeb210]
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(precompile_inlinable_iseqs+0x127) [0x7fddf4e032f7] mjit_compile.c:525
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(mjit_compile+0x36e) [0x7fddf4e03dae] mjit_compile.c:581
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(CRITICAL_SECTION_START+0x0) [0x7fddf4dde6a2] mjit_worker.c:1163
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(convert_unit_to_func) mjit_worker.c:1166
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(CRITICAL_SECTION_START+0x0) [0x7fddf4ddf0f9] mjit_worker.c:1426
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(mjit_worker) mjit_worker.c:1429
/home/hsbt/.rbenv/versions/3.0.0/lib/libruby.so.3.0(mjit_worker+0x1e) [0x7fddf4ef944e] thread_pthread.c:1941
/lib/x86_64-linux-gnu/libpthread.so.0(start_thread+0xd9) [0x7fddf4a6f609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fddf4bc7293]

Full of log is here: https://gist.github.com/hsbt/05690e5c6915efdee47c623a3b829c5a

Updated by jeremyevans0 (Jeremy Evans) 9 months ago

  • Assignee set to k0kubun (Takashi Kokubun)

hsbt (Hiroshi SHIBATA) Does this error occur without -j (e.g. without JIT support)? Is it possible to provide a self contained example?

Updated by k0kubun (Takashi Kokubun) 6 months ago

mjit_compile.c:525 of Ruby 3.0.0 is the only hint about this error, but it seems like a race condition with GC of child ISeqs. I guess this could happen because mjit_mark only marks compiling_iseq. We probably need to mark children as well.

Actions #3

Updated by k0kubun (Takashi Kokubun) 6 months ago

  • Status changed from Open to Assigned
Actions #4

Updated by k0kubun (Takashi Kokubun) 6 months ago

  • Status changed from Assigned to Closed

Applied in changeset git|1aac0e88193a82ed36b43e852c46414181b66455.


Mark inlined ISeqs during MJIT compilation (#4539)

[Bug #17584]

Actions #5

Updated by nagachika (Tomoyuki Chikanaga) 4 months ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.7: DONTNEED, 3.0: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) 4 months ago

  • Backport changed from 2.7: DONTNEED, 3.0: REQUIRED to 2.7: DONTNEED, 3.0: DONE

already backported at 9680ee97e0b3e87c0fc9a65c01de1ee50a1a178b.
ref. https://bugs.ruby-lang.org/issues/17928

Actions

Also available in: Atom PDF