From: lourens@... Date: 2020-03-09T12:50:23+00:00 Subject: [ruby-core:97418] [Ruby master Bug#16682] Ruby 2.7.0p0 crash on exit if there is an active RUBY_INTERNAL_EVENT_GC_EXIT tracepoint Issue #16682 has been updated by methodmissing (Lourens Naud�). The tracepoint instance appears to not be of type TypedData anymore, fails the type check, exception is raised, which allocs a String for the message. ``` #15 0x000055935811e737 in tpptr (tpval=94091343800880) at vm_trace.c:771 771 TypedData_Get_Struct(tpval, rb_tp_t, &tp_data_type, tp); (gdb) p ((((struct RBasic*)(tpval))->flags & RUBY_T_MASK) == RUBY_T_DATA) $21 = 0 (gdb) p ((struct RTypedData *)(tpval))->typed_flag $22 = 0 (gdb) p tp_data_type $23 = {wrap_struct_name = 0x5593582028d0 "tracepoint", function = {dmark = 0x55935811e167 , dfree = 0x0, dsize = 0x55935811e1c3 , dcompact = 0x0, reserved = {0x0}}, parent = 0x0, data = 0x0, flags = 1} ``` byroot (Jean Boussier) wrote in #note-1: > I patched my ruby to print the exception message before it tries to allocate, and ran it a few times: > > ``` > .wrong argument type 140351662971400 > (expected tracepoint) > > .wrong argument type 140321405262280 > (expected tracepoint) > > .wrong argument type 140682039908840 > (expected tracepoint) > > .wrong argument type 140494755846600 > (expected tracepoint) > > .wrong argument type 140445212727760 > (expected tracepoint) > > .wrong argument type 140449339922920 > (expected tracepoint) > ``` ---------------------------------------- Bug #16682: Ruby 2.7.0p0 crash on exit if there is an active RUBY_INTERNAL_EVENT_GC_EXIT tracepoint https://bugs.ruby-lang.org/issues/16682#change-84551 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ``` [BUG] object allocation during garbage collection phase ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0001 p:0001 s:0003 E:002690 (none) [FINISH] -- C level backtrace information ------------------------------------------- /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_vm_bugreport+0x96) [0x10fa9f266] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_bug+0xcc) [0x10faabb86] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(newobj_slowpath+0x99c) [0x10f8f939c] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(newobj_slowpath_wb_protected+0x14) [0x10f8f89d4] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_str_buf_new+0x1e) [0x10fa151be] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_enc_vsprintf+0x48) [0x10fa03178] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_vraise+0x14) [0x10f8d4d84] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_raise+0x7b) [0x10f8d052b] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_check_typeddata+0xf3) [0x10f8d19a3] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(tp_call_trace+0x2a) [0x10faa1aaa] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_exec_event_hooks+0x163) [0x10faa0ab3] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_objspace_call_finalizer+0x8b7) [0x10f8eded7] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(rb_ec_cleanup+0x2de) [0x10f8dc35e] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(ruby_run_node+0x5f) [0x10f8dc4ff] /Users/byroot/.rubies/ruby-2.7.0/bin/ruby(main+0x5d) [0x10f833d0d] ``` It also crash in other circumstances, but I'm not able to reproduce them as easily. Older versions are not affected. I created a repository to easily reproduce the issue: https://github.com/casperisfine/ruby-tracepoint-crash -- https://bugs.ruby-lang.org/ Unsubscribe: