Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT crash on arm64 (Ruby 3.4.1) #566

Closed
asheldon opened this issue Jan 25, 2025 · 1 comment · Fixed by ruby/ruby#12668
Closed

YJIT crash on arm64 (Ruby 3.4.1) #566

asheldon opened this issue Jan 25, 2025 · 1 comment · Fixed by ruby/ruby#12668
Assignees
Labels
bug Something isn't working

Comments

@asheldon
Copy link

ruby: YJIT has panicked. More info to follow...
thread '<unnamed>' panicked at ./yjit/src/backend/arm64/mod.rs:1348:17:
assertion `left != right` failed: should not fail when writing to a fresh code page
  left: Err(RetryOnNextPage)
right: Err(RetryOnNextPage)
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:76:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:373:5
   4: yjit::backend::arm64::<impl yjit::backend::ir::Assembler>::compile_with_regs
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/backend/arm64/mod.rs:1348:17
   5: yjit::backend::ir::Assembler::compile
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/backend/ir.rs:1630:19
   6: yjit::codegen::gen_single_block
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/codegen.rs:1448:27
   7: yjit::core::gen_block_series_body
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3088:23
   8: yjit::core::gen_block_series
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3066:18
   9: yjit::core::branch_stub_hit_body
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3604:17
  10: yjit::core::branch_stub_hit::{{closure}}::{{closure}}
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3493:36
  11: yjit::stats::with_compile_time
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/stats.rs:1084:15
  12: yjit::core::branch_stub_hit::{{closure}}
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3493:13
  13: std::panicking::try::do_call
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:557:40
  14: std::panicking::try
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:520:19
  15: std::panic::catch_unwind
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panic.rs:358:14
  16: yjit::cruby::with_vm_lock
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/cruby.rs:688:21
  17: yjit::core::branch_stub_hit
             at /local/p4clients/pkgbuild-const/workspace/build/Ruby34x/Ruby34x-1.0.234.0/AL2023_aarch64/DEV.STD.PTHREAD/build/private/src/yjit/src/core.rs:3492:9
  18: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[BUG] /local/p4clients/pkgbuild-const/workspace/src/{redacted}/{redacted.rb}:68:  YJIT: panicked at ./yjit/src/backend/arm64/mod.rs:1348:17:
assertion `left != right` failed: should not fail when writing to a fresh code page
  left: Err(RetryOnNextPage)
right: Err(RetryOnNextPage)/40",
Q�
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [aarch64-linux]

Ruby 3.4.1 on Amazon Graviton2. No crash observed in an identical x86_64 setup.

@maximecb
Copy link

@XrXr says this problem should not be difficult for us to fix. We will hopefully have a fix within a couple of days :)

@maximecb maximecb added the bug Something isn't working label Jan 28, 2025
XrXr added a commit to XrXr/ruby that referenced this issue Jan 29, 2025
With a well-timed OOM around a page switch in the backend, it can return
RetryOnNextPage twice and crash due to the assert. (More places can
signal OOM now since VirtualMem tracks Rust malloc heap size for
--yjit-mem-size.)

Return error in these cases instead of crashing.

Fixes: Shopify#566
XrXr added a commit to ruby/ruby that referenced this issue Jan 30, 2025
With a well-timed OOM around a page switch in the backend, it can return
RetryOnNextPage twice and crash due to the assert. (More places can
signal OOM now since VirtualMem tracks Rust malloc heap size for
--yjit-mem-size.)

Return error in these cases instead of crashing.

Fixes: Shopify#566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants