Bug #21967
open`vm_call_cfunc: cfp consistency error` while requiring `nkf.so`
Description
I'm unfortunately unable to reproduce this consistently.
It does happen a few times a day on our production servers, and I have a few core dumps around for investigation if needed.
The crash is always while loading nknf.so.
I'm unfortunately not familiar enough with cfp to investigate this much further myself.
<PATH>/vendor/bundle/ruby/4.0.0/gems/nkf-0.2.0/lib/nkf.so: [BUG] vm_call_cfunc: cfp consistency error (0x0000ffff80779830, 0x0000ffff807797f8)
ruby 4.0.2 (2026-03-17 revision d3da9fec82) +PRISM [aarch64-linux]
-- Control frame information -----------------------------------------------
c:0032 p:---- s:0172 e:000171 l:y b:0001 TOP [FINISH]
c:0031 p:---- s:0169 e:000168 l:y b:---- CFUNC :require
c:0030 p:0033 s:0164 e:000163 l:n b:---- BLOCK <PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bu
c:0029 p:0145 s:0158 e:000157 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/boots
c:0028 p:0026 s:0149 e:000148 l:y b:0001 TOP <PATH>/vendor/bundle/ruby/4.0.0/gems/nkf-0 [FINISH]
c:0027 p:---- s:0146 e:000145 l:y b:---- CFUNC :require
c:0026 p:0033 s:0141 e:000140 l:n b:---- BLOCK <PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bu
c:0025 p:0145 s:0135 e:000134 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/boots
c:0024 p:0011 s:0126 e:000125 l:y b:0001 TOP <PATH>/vendor/bundle/ruby/4.0.0/gems/mecha [FINISH]
c:0023 p:---- s:0123 e:000122 l:y b:---- CFUNC :require
c:0022 p:0033 s:0118 e:000117 l:n b:---- BLOCK <PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bu
c:0021 p:0145 s:0112 e:000111 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/boots
c:0020 p:0265 s:0103 e:000102 l:y b:0001 TOP <PATH>/vendor/bundle/ruby/4.0.0/gems/mecha [FINISH]
c:0019 p:---- s:0100 e:000099 l:y b:---- CFUNC :require
c:0018 p:0011 s:0095 e:000094 l:y b:0001 METHOD <internal:<PATH>/vendor/ruby-4.0.2/lib/rub
c:0017 p:0033 s:0089 e:000088 l:n b:---- BLOCK <PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bu
c:0016 p:0024 s:0083 e:000082 l:n b:---- BLOCK <PATH>/vendor/bundle/ruby/4.0.0/gems/bundl [FINISH]
c:0015 p:---- s:0077 e:000076 l:y b:---- CFUNC :each
c:0014 p:0027 s:0073 e:000072 l:n b:---- BLOCK <PATH>/vendor/bundle/ruby/4.0.0/gems/bundl [FINISH]
c:0013 p:---- s:0069 e:000068 l:y b:---- CFUNC :each
c:0012 p:0042 s:0065 e:000064 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/bundl
c:0011 p:0013 s:0059 e:000058 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/bundl
c:0010 p:0117 s:0054 e:000053 l:y b:0001 TOP <PATH>/config/application.rb:25 [FINISH]
c:0009 p:---- s:0051 e:000050 l:y b:---- CFUNC :require_relative
c:0008 p:0005 s:0046 e:000045 l:y b:0001 TOP <PATH>/config/environment.rb:2 [FINISH]
c:0007 p:---- s:0043 e:000042 l:y b:---- CFUNC :require
c:0006 p:0033 s:0038 e:000037 l:n b:---- BLOCK <PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bu
c:0005 p:0145 s:0032 e:000031 l:y b:0001 METHOD <PATH>/vendor/bundle/ruby/4.0.0/gems/boots
c:0004 p:0011 s:0023 e:000022 l:y b:0001 TOP <PATH>/gems/intercom-sqs/exe/intercom-sqs: [FINISH]
c:0003 p:---- s:0011 e:000010 l:y b:---- CFUNC :load
c:0002 p:0017 s:0006 e:000005 l:n b:---- EVAL bin/intercom-sqs:6 [FINISH]
c:0001 p:0000 s:0003 E:001b40 l:y b:---- DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
bin/intercom-sqs:6:in '<main>'
bin/intercom-sqs:6:in 'load'
<PATH>/gems/intercom-sqs/exe/intercom-sqs:6:in '<main>'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bootsnap-1.22.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in 'require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in replace_require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'require'
<PATH>/config/environment.rb:2:in '<main>'
<PATH>/config/environment.rb:2:in 'require_relative'
<PATH>/config/application.rb:25:in '<main>'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler.rb:213:in 'require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler/runtime.rb:52:in 'require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler/runtime.rb:52:in 'each'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler/runtime.rb:58:in 'block in require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler/runtime.rb:58:in 'each'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bundler-4.0.8/lib/bundler/runtime.rb:63:in 'block (2 levels) in require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in replace_require'
<internal:<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/rubygems/core_ext/kernel_require.rb>:37:in 'require'
<internal:<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/rubygems/core_ext/kernel_require.rb>:37:in 'require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/mechanize-2.10.0/lib/mechanize.rb:1387:in '<main>'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bootsnap-1.22.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in 'require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in replace_require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/mechanize-2.10.0/lib/mechanize/util.rb:3:in '<main>'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bootsnap-1.22.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in 'require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in replace_require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'require'
<PATH>/vendor/bundle/ruby/4.0.0/gems/nkf-0.2.0/lib/nkf.rb:5:in '<main>'
<PATH>/vendor/bundle/ruby/4.0.0/gems/bootsnap-1.22.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in 'require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in replace_require'
<PATH>/vendor/ruby-4.0.2/lib/ruby/4.0.0/bundled_gems.rb:60:in 'require'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- C level backtrace information -------------------------------------------
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_print_backtrace+0x8) [0xaaaab1d0964c] /ruby-4.0.2/vm_dump.c:1105
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_bugreport) /ruby-4.0.2/vm_dump.c:1450
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_bug_without_die_internal+0x70) [0xaaaab1821640] /ruby-4.0.2/error.c:1098
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_bug) /ruby-4.0.2/error.c:1116
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_check_ints+0x0) [0xaaaab19edc54] /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_check_ints) /ruby-4.0.2/vm_core.h:2256
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_pop_frame) /ruby-4.0.2/vm_insnhelper.c:452
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_pop_frame) /ruby-4.0.2/vm_insnhelper.c:461
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3906
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_symbol+0x32c) [0xaaaab19fed34] /ruby-4.0.2/vm_insnhelper.c:4403
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(load_iseq_eval+0x3c) [0xaaaab18a1b44] /ruby-4.0.2/load.c:774
<PATH>/vendor/ruby-4.0.2/bin/ruby(require_internal) /ruby-4.0.2/load.c:1341
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string_internal+0x3c) [0xaaaab18a1f8c] /ruby-4.0.2/load.c:1451
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string) /ruby-4.0.2/load.c:1437
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_f_require) /ruby-4.0.2/load.c:1048
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_symbol+0x32c) [0xaaaab19fed34] /ruby-4.0.2/vm_insnhelper.c:4403
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(load_iseq_eval+0x3c) [0xaaaab18a1b44] /ruby-4.0.2/load.c:774
<PATH>/vendor/ruby-4.0.2/bin/ruby(require_internal) /ruby-4.0.2/load.c:1341
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string_internal+0x3c) [0xaaaab18a1f8c] /ruby-4.0.2/load.c:1451
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string) /ruby-4.0.2/load.c:1437
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_f_require) /ruby-4.0.2/load.c:1048
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_symbol+0x32c) [0xaaaab19fed34] /ruby-4.0.2/vm_insnhelper.c:4403
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(load_iseq_eval+0x3c) [0xaaaab18a1b44] /ruby-4.0.2/load.c:774
<PATH>/vendor/ruby-4.0.2/bin/ruby(require_internal) /ruby-4.0.2/load.c:1341
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string_internal+0x3c) [0xaaaab18a1f8c] /ruby-4.0.2/load.c:1451
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string) /ruby-4.0.2/load.c:1437
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_f_require) /ruby-4.0.2/load.c:1048
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_alias+0x8c) [0xaaaab19fe90c] /ruby-4.0.2/vm_insnhelper.c:4297
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec+0x188) [0xaaaab19fc3f0] /ruby-4.0.2/vm.c:2798
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_yield+0xd0) [0xaaaab1a0131c] /ruby-4.0.2/vm.c:1871
<PATH>/vendor/ruby-4.0.2/bin/ruby(RB_FL_TEST_RAW+0x0) [0xaaaab1bf8968] /ruby-4.0.2/array.c:2754
<PATH>/vendor/ruby-4.0.2/bin/ruby(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:514
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_array_len) ./include/ruby/internal/core/rarray.h:259
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_ary_each) /ruby-4.0.2/array.c:2753
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0x108) [0xaaaab1a0b9f8] /ruby-4.0.2/insns.def:856
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_yield+0xd0) [0xaaaab1a0131c] /ruby-4.0.2/vm.c:1871
<PATH>/vendor/ruby-4.0.2/bin/ruby(RB_FL_TEST_RAW+0x0) [0xaaaab1bf8968] /ruby-4.0.2/array.c:2754
<PATH>/vendor/ruby-4.0.2/bin/ruby(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:514
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_array_len) ./include/ruby/internal/core/rarray.h:259
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_ary_each) /ruby-4.0.2/array.c:2753
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0x108) [0xaaaab1a0b9f8] /ruby-4.0.2/insns.def:856
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(load_iseq_eval+0x3c) [0xaaaab18a1b44] /ruby-4.0.2/load.c:774
<PATH>/vendor/ruby-4.0.2/bin/ruby(require_internal) /ruby-4.0.2/load.c:1341
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string_internal+0x58) [0xaaaab18a1e20] /ruby-4.0.2/load.c:1451
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec+0x188) [0xaaaab19fc3f0] /ruby-4.0.2/vm.c:2798
<PATH>/vendor/ruby-4.0.2/bin/ruby(load_iseq_eval+0x3c) [0xaaaab18a1b44] /ruby-4.0.2/load.c:774
<PATH>/vendor/ruby-4.0.2/bin/ruby(require_internal) /ruby-4.0.2/load.c:1341
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string_internal+0x3c) [0xaaaab18a1f8c] /ruby-4.0.2/load.c:1451
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_require_string) /ruby-4.0.2/load.c:1437
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_f_require) /ruby-4.0.2/load.c:1048
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_symbol+0x32c) [0xaaaab19fed34] /ruby-4.0.2/vm_insnhelper.c:4403
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_loop+0x68) [0xaaaab19fc734] /ruby-4.0.2/vm.c:2825
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec) /ruby-4.0.2/vm.c:2804
<PATH>/vendor/ruby-4.0.2/bin/ruby(raise_load_if_failed+0x0) [0xaaaab18a108c] /ruby-4.0.2/load.c:851
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_load_internal) /ruby-4.0.2/load.c:853
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_f_load+0x84) [0xaaaab18a112c] /ruby-4.0.2/load.c:893
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_cfp_consistent_p+0x0) [0xaaaab19edb00] /ruby-4.0.2/vm_insnhelper.c:3902
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.2/vm_insnhelper.c:3904
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_sendish+0xc4) [0xaaaab19f3750] /ruby-4.0.2/vm_insnhelper.c:6124
<PATH>/vendor/ruby-4.0.2/bin/ruby(vm_exec_core+0xa4) [0xaaaab1a0b994] /ruby-4.0.2/insns.def:904
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_vm_exec+0x188) [0xaaaab19fc3f0] /ruby-4.0.2/vm.c:2798
<PATH>/vendor/ruby-4.0.2/bin/ruby(rb_ec_exec_node+0x8c) [0xaaaab1824c4c] /ruby-4.0.2/eval.c:283
<PATH>/vendor/ruby-4.0.2/bin/ruby(ruby_run_node+0x3c) [0xaaaab182716c] /ruby-4.0.2/eval.c:321
<PATH>/vendor/ruby-4.0.2/bin/ruby(main+0x70) [0xaaaab1821b30] ./main.c:42
Updated by byroot (Jean Boussier) 4 months ago
So for the record, I managed to remove our dependency on nkf, and the issue seem to have disappeared so far.
So this suggest nkf is indeed the root cause, but that is weird because I looked at the extension, and it's really not doing anything out of the ordinary: https://github.com/ruby/nkf/blob/a99304e2b2ffde94002870a67a67ad9648cead8d/ext/nkf/nkf.c#L478-L506
Updated by dodecadaniel (Daniel Colson) 27 days ago
We've got a similar looking crash while loading encodings at boot via the charlock_holmes gem. I think it happens when we get a TERM in the middle of loading the encoding, causing us to longjmp over the line that would normally pop the frame.
I had wondered at one point if https://github.com/ruby/ruby/blob/b52cb82d3c7b2aacdc7b8a452ffe74dbef54db26/load.c#L1315 should have an "else rb_vm_rewind_cfp", but I don't know enough about how this all works.
Updated by byroot (Jean Boussier) 27 days ago
ยท Edited
So the crash did come back later when charlock_holmes was added as a dependency, this time it crash while loading some encoding .so.
ruby-4.0.5/lib/ruby/4.0.0/aarch64-linux/enc/euc_jp.so: [BUG] vm_call_cfunc: cfp consistency error (0x0000ffff8d1789c8, 0x0000ffff8d178990)
ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [aarch64-linux]
-- Ruby level backtrace information ----------------------------------------
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:1:in '<main>'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:2:in '<module:CharlockHolmes>'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:74:in '<class:EncodingDetector>'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:66:in 'build_encoding_table'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:66:in 'each'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:68:in 'block in build_encoding_table'
gems/charlock_holmes-0.7.9/lib/charlock_holmes/encoding_detector.rb:68:in 'find'
-- C level backtrace information -------------------------------------------
ruby-4.0.5/bin/ruby(rb_print_backtrace+0x8) [0xaaaadc689a4c] /ruby-4.0.5/vm_dump.c:1105
ruby-4.0.5/bin/ruby(rb_vm_bugreport) /ruby-4.0.5/vm_dump.c:1450
ruby-4.0.5/bin/ruby(rb_bug_without_die_internal+0x70) [0xaaaadc1a1640] /ruby-4.0.5/error.c:1098
ruby-4.0.5/bin/ruby(rb_bug) /ruby-4.0.5/error.c:1116
ruby-4.0.5/bin/ruby(rb_vm_check_ints+0x0) [0xaaaadc36ee34] /ruby-4.0.5/vm_insnhelper.c:3903
ruby-4.0.5/bin/ruby(rb_vm_check_ints) /ruby-4.0.5/vm_core.h:2256
ruby-4.0.5/bin/ruby(vm_pop_frame) /ruby-4.0.5/vm_insnhelper.c:452
ruby-4.0.5/bin/ruby(rb_vm_pop_frame) /ruby-4.0.5/vm_insnhelper.c:461
ruby-4.0.5/bin/ruby(vm_call_cfunc_with_frame_) /ruby-4.0.5/vm_insnhelper.c:3905
ruby-4.0.5/bin/ruby(vm_sendish+0xc4) [0xaaaadc374950] /ruby-4.0.5/vm_insnhelper.c:6123
ruby-4.0.5/bin/ruby(vm_exec_core+0xa4) [0xaaaadc38cb34] /ruby-4.0.5/insns.def:904
ruby-4.0.5/bin/ruby(rb_vm_exec+0x188) [0xaaaadc37d490] /ruby-4.0.5/vm.c:2798
@dodecadaniel (Daniel Colson) who's experiencing the same problem at GitHub found that this seem to be triggered by a SIGTERM while a .so is being loaded, he was able to reproduce locally with:
Which can be turned into:
Updated by byroot (Jean Boussier) 27 days ago
- Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED
Trying that repro on older Rubies, it does seem to reproduce all the way back to 2.7.8, 2.6.10 seem fine though.
Updated by byroot (Jean Boussier) 27 days ago
should have an "else rb_vm_rewind_cfp", but I don't know enough about how this all works.
Out of curiosity I tried it, it does solve the problem on my machine, it does fail in some case on CI though: https://github.com/ruby/ruby/pull/17447
But you are likely right that this is where the problem is.