From: "gearoiddc (Gearoid de Cleir) via ruby-core" Date: 2025-12-10T20:21:30+00:00 Subject: [ruby-core:124121] [Ruby Bug#21772] ruby: YJIT has panicked StackOpnd(1) should be a heap object, but was ImmSymbol for VALUE(137647867319760) Issue #21772 has been reported by gearoiddc (Gearoid de Cleir). ---------------------------------------- Bug #21772: ruby: YJIT has panicked StackOpnd(1) should be a heap object, but was ImmSymbol for VALUE(137647867319760) https://bugs.ruby-lang.org/issues/21772 * Author: gearoiddc (Gearoid de Cleir) * Status: Open * ruby -v: 3.4.7 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I'm getting a YJIT has panicked crash in my rails app locally when a part of my application rapidly uses a gem I have "auto_session_timeout". If I patch the gem by changing the symbol to a string the error goes away. ``` ruby module AutoSessionTimeout private def session_expired?(c) c.session[:auto_session_expires_at].<(Time.now) end end ``` to ``` ruby def session_expired?(c) c.session["auto_session_expires_at"].<(Time.now) end ``` I can consistently cause the crash but I can't find a way to reproduce the error in a snipped of code. But it looks like YJIT is keeping the key as a sybmol even though it was converted to a string. def [](key) load_for_read! key = key.to_s if key == "session_id" # <-- crash occurs here id&.public_id else @delegate[key] end end Didn't have the same issue on ruby 3.3 with YJIT. System Configuration Ruby Version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [x86_64-linux] Environment: Ubuntu 22.04.5 LTS (x86_64) Backtrace & Logs ``` ruby: YJIT has panicked. More info to follow... thread '' panicked at ./yjit/src/codegen.rs:5018:9: StackOpnd(1) should be a heap object, but was ImmSymbol for VALUE(137647867319760) stack backtrace: 0: __rustc::rust_begin_unwind at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:697:5 1: core::panicking::panic_fmt at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:75:14 2: yjit::codegen::jit_guard_known_klass at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/codegen.rs:5018:9 3: yjit::codegen::gen_equality_specialized at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/codegen.rs:3690:9 4: yjit::codegen::gen_opt_eq at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/codegen.rs:3753:29 5: yjit::codegen::gen_single_block at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/codegen.rs:1382:22 6: yjit::core::gen_block_series_body at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3088:23 7: yjit::core::gen_block_series at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3066:18 8: yjit::core::branch_stub_hit_body at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3604:17 9: yjit::core::branch_stub_hit::{{closure}}::{{closure}} at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3493:36 10: yjit::stats::with_compile_time at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/stats.rs:1084:15 11: yjit::core::branch_stub_hit::{{closure}} at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3493:13 12: std::panicking::catch_unwind::do_call at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:589:40 13: std::panicking::catch_unwind at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:552:19 14: std::panic::catch_unwind at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panic.rs:359:14 15: yjit::cruby::with_vm_lock at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/cruby.rs:688:21 16: yjit::core::branch_stub_hit at /home/travis/.rvm/src/ruby-3.4.7/yjit/src/core.rs:3492:9 17: note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. /home/gearoid/.rvm/gems/ruby-3.4.7@7.2.3/gems/actionpack-7.2.3/lib/action_dispatch/request/session.rb:118: [BUG] YJIT: panicked at ./yjit/src/codegen.rs:5018:9: StackOpnd(1) should be a heap object, but was ImmSymbol for VALUE(137647867319760) ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [x86_64-linux] ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/