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

GC sometimes SEGVs while collecting dtables #65

Closed
liquidev opened this issue Apr 5, 2022 · 2 comments · Fixed by #71
Closed

GC sometimes SEGVs while collecting dtables #65

liquidev opened this issue Apr 5, 2022 · 2 comments · Fixed by #71
Labels
bug Something isn't working GC
Milestone

Comments

@liquidev
Copy link
Member

liquidev commented Apr 5, 2022

This only happens in the REPL, and only sometimes.

> "a"
> "a"
> Gc.collect

Here's some fish code that reproduces the issue reliably:

#!/usr/bin/fish

while true
  printf \"a\"\n\"a\"\nGc.collect\n | ./target/debug/mica
  if test $status -ne 0
    exit 1
  end
end
@liquidev liquidev added bug Something isn't working GC labels Apr 5, 2022
@liquidev
Copy link
Member Author

liquidev commented Apr 5, 2022

Here's a backtrace captured by a coredump:

* thread #1, name = 'mica', stop reason = signal SIGSEGV
  * frame #0: 0x000055f7ce6df0cc mica`core::option::Option$LT$$RF$T$GT$::copied::he3c1d7bfe74ca5ac(self=Option<&core::option::Option<mica_language::gc::GcRaw<mica_language::value::Closure>>> @ 0x00007ffcf3c8db70) at option.rs:1755:19
    frame #1: 0x000055f7ce6a01cf mica`_$LT$core..iter..adapters..copied..Copied$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::hca07a674231b87ae(self=0x00007ffcf3c8dde8) at copied.rs:44:9
    frame #2: 0x000055f7ce6a13de mica`_$LT$core..iter..adapters..fuse..Fuse$LT$I$GT$$u20$as$u20$core..iter..adapters..fuse..FuseImpl$LT$I$GT$$GT$::next::hd97124b0a65addd8(self=0x00007ffcf3c8dde8) at fuse.rs:365:9
    frame #3: 0x000055f7ce6a12ff mica`_$LT$core..iter..adapters..fuse..Fuse$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h29e058535559f7cb(self=0x00007ffcf3c8dde8) at fuse.rs:70:9
    frame #4: 0x000055f7ce6a0752 mica`_$LT$core..iter..adapters..flatten..FlattenCompat$LT$I$C$U$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::hf128e0b9e164aa4d(self=0x00007ffcf3c8dde8) at flatten.rs:299:19
    frame #5: 0x000055f7ce6a047f mica`_$LT$core..iter..adapters..flatten..Flatten$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h23fc05be1bdfd259(self=0x00007ffcf3c8dde8) at flatten.rs:192:9
    frame #6: 0x000055f7ce6fed1a mica`mica_language::gc::Memory::mark_dtable_reachable_rec::h918f332f5ee6cd49(self=0x00007ffcf3c92648, mem=GcRaw<mica_language::bytecode::DispatchTable> @ 0x00007ffcf3c8dd80) at gc.rs:147:24
    frame #7: 0x000055f7ce6fecd3 mica`mica_language::gc::Memory::mark_dtable_reachable_rec::h918f332f5ee6cd49(self=0x00007ffcf3c92648, mem=GcRaw<mica_language::bytecode::DispatchTable> @ 0x00007ffcf3c8de80) at gc.rs:145:13
    frame #8: 0x000055f7ce6fef48 mica`mica_language::gc::Memory::mark_all_gray_reachable::h4acbf482a47ae0ec(self=0x00007ffcf3c92648) at gc.rs:205:16
    frame #9: 0x000055f7ce68961a mica`mica_language::gc::Memory::collect::hb771515776d407aa(self=0x00007ffcf3c92648, roots=(a = core::option::Option<> @ 0x00007ffcf3c8e380, b = core::option::Option<> @ 0x00007ffcf3c8e3a8)) at gc.rs:132:10
    frame #10: 0x000055f7ce699752 mica`mica_language::vm::Fiber::call_control::hf4715bfdd8777ad7(self=0x00007ffcf3c937b8, env=0x00007ffcf3c92540, globals=0x00007ffcf3c92630, gc=0x00007ffcf3c92648, ctl=Control @ 0x00007ffcf3c8e3d8, argument_count=1) at vm.rs:308:22
    frame #11: 0x000055f7ce699204 mica`mica_language::vm::Fiber::enter_function::hca39c8fc321dc86f(self=0x00007ffcf3c937b8, env=0x00007ffcf3c92540, globals=0x00007ffcf3c92630, gc=0x00007ffcf3c92648, closure=GcRaw<mica_language::value::Closure> @ 0x00007ffcf3c8e4c0, argument_count=1) at vm.rs:284:13
    frame #12: 0x000055f7ce69cbf5 mica`mica_language::vm::Fiber::interpret::hc1b33c638664c231(self=0x00007ffcf3c937b8, env=0x00007ffcf3c92540, globals=0x00007ffcf3c92630, gc=0x00007ffcf3c92648) at vm.rs:641:19
    frame #13: 0x000055f7ce47b401 mica`mica_hl::fiber::Fiber::resume::h2abf83396be38057(self=0x00007ffcf3c937b0) at fiber.rs:23:23
    frame #14: 0x000055f7ce49f243 mica`mica::interpret::_$u7b$$u7b$closure$u7d$$u7d$::h0fb5c34c0a0cf525 at main.rs:72:45
    frame #15: 0x000055f7ce49b7b6 mica`_$LT$core..iter..sources..from_fn..FromFn$LT$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::hfb669165750e6d19(self=0x00007ffcf3c937b0) at from_fn.rs:69:9
    frame #16: 0x000055f7ce4a3c69 mica`_$LT$core..iter..adapters..flatten..FlattenCompat$LT$I$C$U$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h320cba3ec9126945(self=0x00007ffcf3c93718) at flatten.rs:294:23
    frame #17: 0x000055f7ce4a3bd6 mica`_$LT$core..iter..adapters..flatten..Flatten$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h15780c3d2d0dde10(self=0x00007ffcf3c93718) at flatten.rs:192:9
    frame #18: 0x000055f7ce47b841 mica`_$LT$core..iter..adapters..fuse..Fuse$LT$I$GT$$u20$as$u20$core..iter..adapters..fuse..FuseImpl$LT$I$GT$$GT$::next::hf35964c994710594(self=0x00007ffcf3c93718) at fuse.rs:365:9
    frame #19: 0x000055f7ce47b786 mica`_$LT$core..iter..adapters..fuse..Fuse$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::ha1777f3540071b07(self=0x00007ffcf3c93718) at fuse.rs:70:9
    frame #20: 0x000055f7ce4a408a mica`_$LT$core..iter..adapters..flatten..FlattenCompat$LT$I$C$U$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::hec38e7866fc01db1(self=0x00007ffcf3c93718) at flatten.rs:299:19
    frame #21: 0x000055f7ce4a3bf6 mica`_$LT$core..iter..adapters..flatten..Flatten$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h80d3ad2296334163(self=0x00007ffcf3c93718) at flatten.rs:192:9
    frame #22: 0x000055f7ce49495b mica`mica::repl::h157ff84a9761513f(engine_options=0x00007ffcf3c93a88) at main.rs:111:21
    frame #23: 0x000055f7ce494bd6 mica`mica::main::h96b711c30d0cdb43 at main.rs:135:7
    frame #24: 0x000055f7ce475a1b mica`core::ops::function::FnOnce::call_once::hd06b0bdb256b676c((null)=(mica`mica::main::h96b711c30d0cdb43 at main.rs:120), (null)=<unavailable>) at function.rs:227:5
    frame #25: 0x000055f7ce49f75e mica`std::sys_common::backtrace::__rust_begin_short_backtrace::h36ced528fa18bc53(f=(mica`mica::main::h96b711c30d0cdb43 at main.rs:120)) at backtrace.rs:122:18
    frame #26: 0x000055f7ce474e91 mica`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h80edc60958cf3d45 at rt.rs:145:18
    frame #27: 0x000055f7ce71f0fe mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::hdb5c472c8933c85f at function.rs:259:13
    frame #28: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panicking::try::do_call::h7655f94a1d21bccc at panicking.rs:492:40
    frame #29: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panicking::try::h5dd2ba2ac3a43bfe at panicking.rs:456:19
    frame #30: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panic::catch_unwind::h5d7e31322f6d63dd at panic.rs:137:14
    frame #31: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::h41a646921a7b21f6 at rt.rs:128:48
    frame #32: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panicking::try::do_call::h18284440578558f1 at panicking.rs:492:40
    frame #33: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panicking::try::h768d8b30463938d9 at panicking.rs:456:19
    frame #34: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 [inlined] std::panic::catch_unwind::hfdd0843d7d8b5025 at panic.rs:137:14
    frame #35: 0x000055f7ce71f0f8 mica`std::rt::lang_start_internal::h72f1a7b2c2989a79 at rt.rs:128:20
    frame #36: 0x000055f7ce474e60 mica`std::rt::lang_start::h90a512d947521cc8(main=(mica`mica::main::h96b711c30d0cdb43 at main.rs:120), argc=1, argv=0x00007ffcf3c952f8) at rt.rs:144:17
    frame #37: 0x000055f7ce495c3c mica`main + 28
    frame #38: 0x00007f7646fd2310 libc.so.6`__libc_start_call_main + 128
    frame #39: 0x00007f7646fd23c1 libc.so.6`__libc_start_main@@GLIBC_2.34 + 129
    frame #40: 0x000055f7ce474855 mica`_start + 37

I generated a few coredumps with the script above and the crash always seems to happen there.

@liquidev liquidev added this to the 0.4.0 milestone Jun 1, 2022
@liquidev
Copy link
Member Author

liquidev commented Jun 1, 2022

I identified that this seems to only happen with the new lists branch. master is unaffected.

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

Successfully merging a pull request may close this issue.

1 participant