Skip to content

Allocation panic: for (addr_a - addr_b), a needs to be larger than b #4

@angussidney

Description

@angussidney

When running certain Ruby tests, this error message is displayed:

angusa@rat:~/ruby-reset/repos/ruby$ RUST_BACKTRACE=full make test-all ADDITIONAL_EXCLUDES="--excludes-dir=./test/excludes/_third_party_heap"
Gem::Indexer tests are being skipped.  Install builder gem.
generate_index tests are being skipped.  Install builder gem.
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" --excludes-dir=./test/excludes --excludes-dir=./test/excludes/_third_party_heap --name=!/memory_leak/

# Running tests:

[  551/20997] DRbTests::TestBug16634#test_bug16634thread '<unnamed>' panicked at 'for (addr_a - addr_b), a needs to be larger than b', /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/util/address.rs:73:9
stack backtrace:
   0:     0x7ffa3490eca5 - backtrace::backtrace::libunwind::trace::h34afbfad7fd770fc
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7ffa3490eca5 - backtrace::backtrace::trace_unsynchronized::h460d522b1619a600
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7ffa3490eca5 - std::sys_common::backtrace::_print_fmt::ha45fac10086813b4
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7ffa3490eca5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hde84f63fcfd0e6de
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7ffa34931bfc - core::fmt::write::h540ac4a6a1232abc
                               at src/libcore/fmt/mod.rs:1076
   5:     0x7ffa3490c792 - std::io::Write::write_fmt::hc344eafd6e850b4d
                               at src/libstd/io/mod.rs:1537
   6:     0x7ffa34910da0 - std::sys_common::backtrace::_print::h4db88ff15cb5d61d
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7ffa34910da0 - std::sys_common::backtrace::print::h5fc39e1b1f610bd3
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7ffa34910da0 - std::panicking::default_hook::{{closure}}::h59e55edacb1d974a
                               at src/libstd/panicking.rs:198
   9:     0x7ffa34910aec - std::panicking::default_hook::heee4c8016dfbf328
                               at src/libstd/panicking.rs:217
  10:     0x7ffa34911363 - std::panicking::rust_panic_with_hook::h8405b6301c79fb5a
                               at src/libstd/panicking.rs:526
  11:     0x7ffa34859b59 - std::panicking::begin_panic::h0b35c67eb3ded770
                               at /opt/rust/toolchains/nightly-2020-07-08-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:456
  12:     0x7ffa346f652b - <mmtk::util::address::Address as core::ops::arith::Sub>::sub::h465e14fbf5b19c4a
                               at /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/util/address.rs:73
  13:     0x7ffa346a8714 - mmtk::util::alloc::allocator::fill_alignment_gap::h1687557cdaa3fa8b
                               at /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/util/alloc/allocator.rs:69
  14:     0x7ffa346a8714 - <mmtk::util::alloc::bumpallocator::BumpAllocator<VM> as mmtk::util::alloc::allocator::Allocator<VM>>::alloc::h0d980728c2f5d918
                               at /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/util/alloc/bumpallocator.rs:59
  15:     0x7ffa346cd3c3 - <mmtk::plan::mutator_context::Mutator<P> as mmtk::plan::mutator_context::MutatorContext<<P as mmtk::plan::global::Plan>::VM>>::alloc::hcae568a0a37163ab
                               at /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/plan/mutator_context.rs:65
  16:     0x7ffa346d2762 - mmtk::mm::memory_manager::alloc::h326b515f415aea5b
                               at /home/angusa/.cargo/git/checkouts/mmtk-core-f2f4fd5198943d3c/966047a/src/mm/memory_manager.rs:107
  17:     0x7ffa346b4592 - alloc
                               at src/api.rs:43
  18:     0x55624b9b27dc - objspace_xmalloc0
                               at /home/angusa/ruby-reset/repos/ruby/gc.c:9998
  19:     0x55624b9b29ee - ruby_xmalloc0
                               at /home/angusa/ruby-reset/repos/ruby/gc.c:10256
  20:     0x55624b9b2a1d - ruby_xmalloc_body
                               at /home/angusa/ruby-reset/repos/ruby/gc.c:10265
  21:     0x55624b9b662a - ruby_xmalloc
                               at /home/angusa/ruby-reset/repos/ruby/gc.c:12164
  22:     0x55624bad9903 - rb_register_sigaltstack
                               at /home/angusa/ruby-reset/repos/ruby/signal.c:555
  23:     0x55624bb10d2e - thread_start_func_1
                               at /home/angusa/ruby-reset/repos/ruby/thread_pthread.c:953
  24:     0x7ffa358716db - start_thread
                               at /build/glibc-S9d2JN/glibc-2.27/nptl/pthread_create.c:463
  25:     0x7ffa3438771f - __clone
  26:                0x0 - <unknown>
fatal runtime error: failed to initiate panic, error 5
 = 1.08 s
  1) Error:
DRbTests::TestBug16634#test_bug16634:
DRb::DRbConnError: execution expired
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:580:in `read'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:580:in `load'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:639:in `recv_reply'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:941:in `recv_reply'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1324:in `send_message'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1143:in `block (2 levels) in method_missing'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1302:in `open'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1142:in `block in method_missing'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1161:in `with_friend'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/drb.rb:1141:in `method_missing'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/extservm.rb:40:in `block in service'
    /home/angusa/ruby-reset/repos/ruby/.ext/common/monitor.rb:202:in `synchronize'
    /home/angusa/ruby-reset/repos/ruby/.ext/common/monitor.rb:202:in `mon_synchronize'
    /home/angusa/ruby-reset/repos/ruby/lib/drb/extservm.rb:37:in `service'
    /home/angusa/ruby-reset/repos/ruby/test/drb/drbtest.rb:36:in `block in ext_service'
    /home/angusa/ruby-reset/repos/ruby/lib/timeout.rb:105:in `timeout'
    /home/angusa/ruby-reset/repos/ruby/tool/lib/envutil.rb:72:in `timeout'
    /home/angusa/ruby-reset/repos/ruby/test/drb/drbtest.rb:35:in `ext_service'
    /home/angusa/ruby-reset/repos/ruby/test/drb/drbtest.rb:87:in `setup_service'
    /home/angusa/ruby-reset/repos/ruby/test/drb/test_drb.rb:357:in `setup'

My understanding is that this error occurs when MMTk allocates via the fastpath (bump pointer allocation), and the call to the align_allocation_no_fill function aligns the address backwards, rather than forwards.

I suspect that this is possibly occuring due to some weird mixups between the two separate instances of MMTk in the two processes being used to test DRb. However, I'm not sure if this is actually the cause, and I'm not sure if the issue is any more widespread than just in the DRb module.

It may be worth investigating this further once MMTk Ruby is updated to support the latest version of MMTk core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions