Project

General

Profile

Actions

Bug #17879

closed

[BUG] id == 0 but not shareable in `rb_ractor_confirm_belonging`

Added by byroot (Jean Boussier) almost 3 years ago. Updated almost 3 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-05-21T19:16:35Z b2fc592c30) RUBY_DEBUG
[ruby-core:103958]

Description

I recently re-enabled our ruby-head CI with -DRUBY_DEBUG, and we're hitting this bug consistently, and early in the test suite.

What's very weird is that we're not using Ractors at all.

/app/lib/active_support/cache/versioned_memcached_store.rb:160: [BUG] id == 0 but not shareable
ruby 3.1.0dev (2021-05-21T19:16:35Z shopify b2fc592c30) [x86_64-linux]
-- C level backtrace information -------------------------------------------
/usr/local/bin/ruby(rb_print_backtrace+0x11) [0x55c4b1f0ecf7] vm_dump.c:759
/usr/local/bin/ruby(rb_vm_bugreport) vm_dump.c:1041
/usr/local/bin/ruby(bug_report_end+0x0) [0x55c4b1d42a1f] error.c:777
/usr/local/bin/ruby(rb_bug_without_die) error.c:777
/usr/local/bin/ruby(die+0x0) [0x55c4b1d1157a] error.c:785
/usr/local/bin/ruby(rb_bug) error.c:787
/usr/local/bin/ruby(rb_ractor_confirm_belonging+0x29) [0x55c4b1ee0af5] ractor_core.h:328
/usr/local/bin/ruby(rb_ractor_confirm_belonging) ractor_core.h:321
/usr/local/bin/ruby(vm_exec_core+0x3231) [0x55c4b1efea71] vm.inc:2561
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_ec_ractor_ptr+0x0) [0x55c4b1ef1e8a] vm.c:1290
/usr/local/bin/ruby(rb_ec_ractor_hooks) vm_core.h:2004
/usr/local/bin/ruby(invoke_bmethod) vm.c:1292
/usr/local/bin/ruby(invoke_iseq_block_from_c) vm.c:1335
/usr/local/bin/ruby(invoke_block_from_c_proc) vm.c:1432
/usr/local/bin/ruby(rb_vm_invoke_bmethod) vm.c:1468
/usr/local/bin/ruby(vm_call_bmethod+0x16b) [0x55c4b1ef22ab] vm_insnhelper.c:3002
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x3302) [0x55c4b1efeb42] insns.def:860
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(vm_call0_body+0x40f) [0x55c4b1ef6aff] vm_eval.c:178
/usr/local/bin/ruby(rb_vm_call0+0xfb) [0x55c4b1ef712b] vm_eval.c:57
/usr/local/bin/ruby(umethod_bind_call+0x11e) [0x55c4b1e0b2ee] proc.c:2437
/usr/local/bin/ruby(vm_call_cfunc_with_frame+0x10e) [0x55c4b1ee4c6e] vm_insnhelper.c:2943
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x16c) [0x55c4b1efb9ac] insns.def:754
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_ec_ractor_ptr+0x0) [0x55c4b1ef1e8a] vm.c:1290
/usr/local/bin/ruby(rb_ec_ractor_hooks) vm_core.h:2004
/usr/local/bin/ruby(invoke_bmethod) vm.c:1292
/usr/local/bin/ruby(invoke_iseq_block_from_c) vm.c:1335
/usr/local/bin/ruby(invoke_block_from_c_proc) vm.c:1432
/usr/local/bin/ruby(rb_vm_invoke_bmethod) vm.c:1468
/usr/local/bin/ruby(vm_call_bmethod+0x16b) [0x55c4b1ef22ab] vm_insnhelper.c:3002
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0xf7) [0x55c4b1efb937] insns.def:773
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(vm_call0_body+0x40f) [0x55c4b1ef6aff] vm_eval.c:178
/usr/local/bin/ruby(rb_vm_call0+0xfb) [0x55c4b1ef712b] vm_eval.c:57
/usr/local/bin/ruby(umethod_bind_call+0x11e) [0x55c4b1e0b2ee] proc.c:2437
/usr/local/bin/ruby(vm_call_cfunc_with_frame+0x10e) [0x55c4b1ee4c6e] vm_insnhelper.c:2943
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x16c) [0x55c4b1efb9ac] insns.def:754
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_ec_ractor_ptr+0x0) [0x55c4b1ef1e8a] vm.c:1290
/usr/local/bin/ruby(rb_ec_ractor_hooks) vm_core.h:2004
/usr/local/bin/ruby(invoke_bmethod) vm.c:1292
/usr/local/bin/ruby(invoke_iseq_block_from_c) vm.c:1335
/usr/local/bin/ruby(invoke_block_from_c_proc) vm.c:1432
/usr/local/bin/ruby(rb_vm_invoke_bmethod) vm.c:1468
/usr/local/bin/ruby(vm_call_bmethod+0x16b) [0x55c4b1ef22ab] vm_insnhelper.c:3002
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0xf7) [0x55c4b1efb937] insns.def:773
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(vm_call0_body+0x40f) [0x55c4b1ef6aff] vm_eval.c:178
/usr/local/bin/ruby(rb_vm_call0+0xfb) [0x55c4b1ef712b] vm_eval.c:57
/usr/local/bin/ruby(umethod_bind_call+0x11e) [0x55c4b1e0b2ee] proc.c:2437
/usr/local/bin/ruby(vm_call_cfunc_with_frame+0x10e) [0x55c4b1ee4c6e] vm_insnhelper.c:2943
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x16c) [0x55c4b1efb9ac] insns.def:754
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_ec_ractor_ptr+0x0) [0x55c4b1ef1e8a] vm.c:1290
/usr/local/bin/ruby(rb_ec_ractor_hooks) vm_core.h:2004
/usr/local/bin/ruby(invoke_bmethod) vm.c:1292
/usr/local/bin/ruby(invoke_iseq_block_from_c) vm.c:1335
/usr/local/bin/ruby(invoke_block_from_c_proc) vm.c:1432
/usr/local/bin/ruby(rb_vm_invoke_bmethod) vm.c:1468
/usr/local/bin/ruby(vm_call_bmethod+0x16b) [0x55c4b1ef22ab] vm_insnhelper.c:3002
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0xf7) [0x55c4b1efb937] insns.def:773
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(yield_under+0x264) [0x55c4b1ef4f24] vm.c:1387
/usr/local/bin/ruby(vm_call_cfunc_with_frame+0x10e) [0x55c4b1ee4c6e] vm_insnhelper.c:2943
/usr/local/bin/ruby(vm_call_method_each_type+0x7d) [0x55c4b1ef23ad] vm_insnhelper.c:3433
/usr/local/bin/ruby(vm_call_method+0x11f) [0x55c4b1ef2bff] vm_insnhelper.c:3551
/usr/local/bin/ruby(vm_call_symbol+0x15d) [0x55c4b1ef32dd] vm_insnhelper.c:3157
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x16c) [0x55c4b1efb9ac] insns.def:754
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_ec_ractor_ptr+0x0) [0x55c4b1ef1e8a] vm.c:1290
/usr/local/bin/ruby(rb_ec_ractor_hooks) vm_core.h:2004
/usr/local/bin/ruby(invoke_bmethod) vm.c:1292
/usr/local/bin/ruby(invoke_iseq_block_from_c) vm.c:1335
/usr/local/bin/ruby(invoke_block_from_c_proc) vm.c:1432
/usr/local/bin/ruby(rb_vm_invoke_bmethod) vm.c:1468
/usr/local/bin/ruby(vm_call_bmethod+0x16b) [0x55c4b1ef22ab] vm_insnhelper.c:3002
/usr/local/bin/ruby(vm_call_method_each_type+0x1b5) [0x55c4b1ef24e5] vm_insnhelper.c:3459
/usr/local/bin/ruby(vm_call_method+0x11f) [0x55c4b1ef2bff] vm_insnhelper.c:3551
/usr/local/bin/ruby(vm_call_symbol+0x15d) [0x55c4b1ef32dd] vm_insnhelper.c:3157
/usr/local/bin/ruby(vm_call_method_each_type+0x62d) [0x55c4b1ef295d] vm_insnhelper.c:3469
/usr/local/bin/ruby(vm_call_method+0x11f) [0x55c4b1ef2bff] vm_insnhelper.c:3551
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0xf7) [0x55c4b1efb937] insns.def:773
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(catch_i+0x9d) [0x55c4b1ef59ad] vm.c:1395
/usr/local/bin/ruby(vm_catch_protect+0x107) [0x55c4b1eeb087] vm_eval.c:2418
/usr/local/bin/ruby(rb_catch_obj+0x28) [0x55c4b1eeb31d] vm_eval.c:2444
/usr/local/bin/ruby(rb_f_catch) vm_eval.c:2394
/usr/local/bin/ruby(vm_call_cfunc_with_frame+0x10e) [0x55c4b1ee4c6e] vm_insnhelper.c:2943
/usr/local/bin/ruby(vm_sendish+0x30e) [0x55c4b1ef070e] vm_insnhelper.c:4521
/usr/local/bin/ruby(vm_exec_core+0x16c) [0x55c4b1efb9ac] insns.def:754
/usr/local/bin/ruby(rb_vm_exec+0xbc) [0x55c4b1ef0f2c] vm.c:2169
/usr/local/bin/ruby(rb_vm_invoke_proc+0x6f) [0x55c4b1ef664f] vm.c:1482
/usr/local/bin/ruby(rb_proc_call+0x117) [0x55c4b1e080b7] proc.c:1001
/usr/local/bin/ruby(exec_end_procs_chain+0x44) [0x55c4b1d4cd6d] eval_jump.c:105
/usr/local/bin/ruby(rb_ec_exec_end_proc) eval_jump.c:120
/usr/local/bin/ruby(rb_ec_teardown+0xdd) [0x55c4b1d4cf6d] eval.c:175
/usr/local/bin/ruby(rb_ec_cleanup+0x1f1) [0x55c4b1d4d221] eval.c:243
/usr/local/bin/ruby(ruby_run_node+0x62) [0x55c4b1d4dcb2] eval.c:375
/usr/local/bin/ruby(main+0x73) [0x55c4b1d3f4d3] ./main.c:47
Actions #1

Updated by byroot (Jean Boussier) almost 3 years ago

  • Description updated (diff)

Updated by xtkoba (Tee KOBAYASHI) almost 3 years ago

Ractor setup is invoked even if it is never used, so it is not weird.

I guess this is a false alarm due to incorrect debugging assertions. It should be fixed of course.

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

That message is here:

        if (UNLIKELY(!rb_ractor_shareable_p(obj))) {
            rp(obj);
            rb_bug("id == 0 but not shareable");
        }

What was dumped before the message?

Updated by byroot (Jean Boussier) almost 3 years ago

Ah right, I missed it in the output, here you go:

<OBJ_INFO:rb_ractor_confirm_belonging@ractor_core.h:327> 0x00007fe2577028f8 [0    U] T_STRING (String)63

Updated by byroot (Jean Boussier) almost 3 years ago

So after digging more I noticed the String was coming from the memcached client, and created by this dirty hack: https://github.com/arthurnn/memcached/blob/e5390741c008c4c7cbb91634009bfd57e99ec851/ext/rlibmemcached/rlibmemcached.i#L159-L173

So that's actually a third party issue, I tested that removing this outdated hack fixes the issue.

Actions #6

Updated by alanwu (Alan Wu) almost 3 years ago

  • Status changed from Open to Third Party's Issue
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0