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

Segfault on exit related to local_data #570

Closed
metajack opened this issue Jul 10, 2013 · 7 comments
Closed

Segfault on exit related to local_data #570

metajack opened this issue Jul 10, 2013 · 7 comments

Comments

@metajack
Copy link
Contributor

@metajack metajack commented Jul 10, 2013

If you exit servo by closing the window chrome or by hitting Esc, it segfaults. Here's a stack trace:

0x00000001019f68fb in task::local_data_priv::local_data_lookup_17026::_5c98b2c18161618::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
(gdb) where
#0  0x00000001019f68fb in task::local_data_priv::local_data_lookup_17026::_5c98b2c18161618::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#1  0x0000000101a7e7b0 in task::local_data_priv::local_get_helper_28801::_ca840e152b3e46::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#2  0x00000001019ccfb0 in script_task::__extensions__::meth_12842::drop::_7a479e483d71e91f::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#3  0x00000001019ccdf9 in script_task..ScriptTask::_1f704d29a1a8c98c::glue_drop_12840 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#4  0x0000000101a7e9f9 in task::local_data_priv::local_get_helper_28801::anon::expr_fn_28804 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#5  0x0000000101a916e0 in __morestack ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#6  0x0000000101a7e7e6 in task::local_data_priv::local_get_helper_28801::_ca840e152b3e46::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#7  0x00000001019ccfb0 in script_task::__extensions__::meth_12842::drop::_7a479e483d71e91f::_0$x2e1 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#8  0x00000001019ccdf9 in script_task..ScriptTask::_1f704d29a1a8c98c::glue_drop_12840 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#9  0x0000000101a0dead in _$SP$script_task..ScriptTask::_a3d8c6414a8bde::glue_drop_18663 ()
   from /Users/jack/src/servo/build/src/components/script/libscript-f0d23c13703571c8-0.1.dylib
#10 0x0000000100259871 in _$SP$task..local_data_priv..LocalData.$x27static::_1f31a164c1ae45::glue_drop_13970 ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#11 0x00000001002597b7 in _$LP$$RP$libc..types..common..c95..c_void$C$$RP$libc..types..common..c95..c_void$C$$SP$task..local_data_priv..LocalData.$x27static$RP$::_92c29b881712fe90::glue_drop_13964 ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#12 0x0000000100259760 in option..Option$LT$$LP$$RP$libc..types..common..c95..c_void$C$$RP$libc..types..common..c95..c_void$C$$SP$task..local_data_priv..LocalData.$x27static$RP$$GT$::_99c676dab94598ec::glue_drop_13958 ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#13 0x0000000100293166 in task::local_data_priv::cleanup_task_local_map::_9565741351cd5594::_0$x2e8$x2dpre ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#14 0x0000000100294ac2 in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::__rust_abi ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#15 0x0000000100294b1f in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::__rust_stack_shim ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#16 0x0000000101ba0a51 in __morestack ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#17 0x0000000101b915f7 in rust_task::call_on_rust_stack(void*, void*) ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#18 0x0000000101b9266f in upcall_call_shim_on_rust_stack (args=0x10f153fe0, 
    fn_ptr=0x10f153fb0) at rust_upcall.cpp:92
#19 0x0000000100294a6f in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::_1d51392a8bf471b::_0$x2e8$x2dpre ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#20 0x0000000101b90d6e in cleanup_task(cleanup_args*) ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#21 0x0000000101ba0a51 in __morestack ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#22 0x0000000101b913e0 in rust_task::call_on_c_stack(void*, void*) ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#23 0x0000000101b910d6 in task_start_wrapper(spawn_args*) ()
   from /Users/jack/src/servo/build/src/compiler/rust/x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#24 0x0000000000000000 in ?? ()
@jdm
Copy link
Member

@jdm jdm commented Jul 10, 2013

Oh, we store a @ScriptTask in task-local storage, and the ScriptTask dtor calls local_data_pop to avoid a leak. That sounds... problematic...

@tikue
Copy link

@tikue tikue commented Jul 10, 2013

Pipelines currently never exit for this same reason. See main/constellation.rs

@jdm
Copy link
Member

@jdm jdm commented Jul 13, 2013

I suggest moving the contents of drop into the codepath of the Exit message and getting rid of the destructor (and #[unsafe_destructor]) annotation entirely.

@kmcallister
Copy link
Contributor

@kmcallister kmcallister commented Jul 15, 2013

I'll work on that.

@kmcallister
Copy link
Contributor

@kmcallister kmcallister commented Jul 15, 2013

After deleting the ScriptTask dtor and its call to local_data_pop, I get

memory_region.cpp:73: void memory_region::free(void*): Assertion `false && "live_allocs < 1"' failed.

inside the call to JS_DestroyContext from Drop for Cx. So something is going wrong in the dtors for ScriptTask components, separate from the local_data_pop issue. The assertion trips when the SpiderMonkey GC calls back into Rust to finalize DOM elements.

Full traceback:

rust: ~"\"dropping Cx\""
servo: /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/memory_region.cpp:73: void memory_region::free(void*): Assertion `false && "live_allocs < 1"' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff7fc8700 (LWP 18828)]
0x00007ffff0dfd475 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff0dfd475 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff0e006f0 in *__GI_abort () at abort.c:92
#2  0x00007ffff0df6621 in *__GI___assert_fail (assertion=0x7ffff34fa422 "false && \"live_allocs < 1\"", file=<optimized out>, line=73, 
    function=0x7ffff34fa440 "void memory_region::free(void*)") at assert.c:81
#3  0x00007ffff34e37f1 in memory_region::free (this=0x7fffe83138d0, mem=0xe60d80)
    at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/memory_region.cpp:73
#4  0x00007ffff34d76ea in rust_upcall_free_noswitch (ptr=0xe60d80) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_upcall.cpp:252
#5  0x00007ffff788feaa in unstable::lang::rustrt::rust_upcall_free_noswitch::_5e039b79b41260::_0$x2e8$x2dpre ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#6  0x00007ffff78e2940 in __morestack ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#7  0x00007ffff771e01b in unstable::lang::local_free::_bf6638d34c91b178::_0$x2e8$x2dpre ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#8  0x00007ffff3965423 in dom::bindings::element::finalize::__rust_stack_shim ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#9  0x00007ffff3a2eb28 in __morestack () from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#10 0x00007ffff34e6379 in __morestack ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so
#11 0x00007ffff34d6d49 in call_on_rust_stack (fn_ptr=0x7ffff3965330, args=0x7fffd3ffeb10, this=0x7fffe83137b0)
    at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.h:519
#12 upcall_call_shim_on_rust_stack (args=0x7fffd3ffeb10, fn_ptr=0x7ffff3965330) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_upcall.cpp:92
#13 0x00007ffff396505d in dom::bindings::element::finalize::_1747c3ac191ee85d::_0$x2e1 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#14 0x00007ffff4713cf0 in finalize (this=0x7fffdb10a460, fop=0x7fffd3ffeca0)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsobjinlines.h:235
#15 finalize<JSObject> (thingSize=48, thingKind=<optimized out>, fop=0x7fffd3ffeca0, this=0x7fffdb10a000)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:348
#16 FinalizeTypedArenas<JSObject> (budget=..., thingKind=<optimized out>, src=0x7fffd3ffec28, fop=0x7fffd3ffeca0, dest=...)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:412
#17 js::gc::FinalizeArenas (fop=fop@entry=0x7fffd3ffeca0, src=src@entry=0x7fffd3ffec28, dest=..., thingKind=thingKind@entry=js::gc::FINALIZE_OBJECT2,
    budget=...) at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:449
#18 0x00007ffff4714936 in finalizeNow (thingKind=js::gc::FINALIZE_OBJECT2, fop=0x7fffd3ffeca0, this=0x7fffe83029e8)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:1627
#19 js::gc::ArenaLists::queueObjectsForSweep (this=0x7fffe83029e8, fop=fop@entry=0x7fffd3ffeca0)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:1723
#20 0x00007ffff471595c in BeginSweepPhase (rt=rt@entry=0x7fffdb7b2010) at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:3752
#21 0x00007ffff471753e in IncrementalCollectSlice (rt=rt@entry=0x7fffdb7b2010, budget=budget@entry=0, reason=js::gcreason::LAST_CONTEXT, gckind=js::GC_NORMAL)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4216
#22 0x00007ffff4718284 in GCCycle (rt=rt@entry=0x7fffdb7b2010, incremental=incremental@entry=false, budget=budget@entry=0, gckind=gckind@entry=js::GC_NORMAL,
    reason=reason@entry=js::gcreason::LAST_CONTEXT) at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4394
#23 0x00007ffff4718679 in Collect (rt=0x7fffdb7b2010, incremental=false, budget=0, gckind=js::GC_NORMAL, reason=js::gcreason::LAST_CONTEXT)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4502
#24 0x00007ffff46dd474 in js::DestroyContext (cx=0x7fffe8318740, mode=<optimized out>)
    at /home/keegan/proj/servo/servo/src/support/spidermonkey/mozjs/js/src/jscntxt.cpp:394
#25 0x00007ffff34e6379 in __morestack ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so
#26 0x00007ffff34d6a4c in call_on_c_stack (fn_ptr=0x7ffff468b090, args=0x7fffe83181d0, this=0x7fffe83137b0)
    at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.h:481
#27 upcall_call_shim_on_c_stack (args=0x7fffe83181d0, fn_ptr=0x7ffff468b090) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_upcall.cpp:70
#28 0x00007ffff469e37a in rust::__extensions__::meth_6426::drop::_b0c753941dbf8bb4::_0$x2e1 ()
   from /home/keegan/proj/servo/servo/build/src/support/spidermonkey/rust-mozjs/libjs-2b1863329f7b31d9-0.1.so
#29 0x00007ffff39565d5 in js..rust..Cx::_75f9949221a63075::glue_drop_15178 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#30 0x00007ffff3957b2b in std..hashmap..Bucket$LT$$UP$str$C$$SP$js..rust..jsobj_rsrc$GT$::_547ab6aa3d9a4bd::glue_drop_15366 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#31 0x00007ffff3956d16 in js..rust..Compartment::_3bcfccd6b5257f65::glue_drop_15232 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#32 0x00007ffff394d4dd in script_task..ScriptTask::_28ffda47d87211ad::glue_drop_12995 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#33 0x00007ffff399c88d in _$SP$script_task..ScriptTask::_2b4f4bd534e9c01c::glue_drop_19284 ()
   from /home/keegan/proj/servo/servo/build/src/components/script/libscript-5b34013c7d330-0.1.so
#34 0x00007ffff777dc11 in _$SP$task..local_data_priv..LocalData.$x27static::_1f31a164c1ae45::glue_drop_13970 ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#35 0x00007ffff777db57 in _$LP$$RP$libc..types..common..c95..c_void$C$$RP$libc..types..common..c95..c_void$C$$SP$task..local_data_priv..LocalData.$x27static$RP$::_92c29b881712fe90::glue_drop_13964 ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#36 0x00007ffff777db00 in option..Option$LT$$LP$$RP$libc..types..common..c95..c_void$C$$RP$libc..types..common..c95..c_void$C$$SP$task..local_data_priv..LocalData.$x27static$RP$$GT$::_99c676dab94598ec::glue_drop_13958 ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#37 0x00007ffff77b75f6 in task::local_data_priv::cleanup_task_local_map::_9565741351cd5594::_0$x2e8$x2dpre ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#38 0x00007ffff77b8f52 in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::__rust_abi ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
---Type <return> to continue, or q <return> to quit---
#39 0x00007ffff77b8faf in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::__rust_stack_shim ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#40 0x00007ffff34e6379 in __morestack ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so
#41 0x00007ffff34d6d49 in call_on_rust_stack (fn_ptr=0x7ffff77b8f60, args=0x7fffd3ffefe0, this=0x7fffe83137b0)
    at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.h:519
#42 upcall_call_shim_on_rust_stack (args=0x7fffd3ffefe0, fn_ptr=0x7ffff77b8f60) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_upcall.cpp:92
#43 0x00007ffff77b8eff in task::local_data_priv::get_task_local_map::cleanup_task_local_map_extern_cb::_1d51392a8bf471b::_0$x2e8$x2dpre ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8-pre.so
#44 0x00007ffff34d4d32 in cleanup_task (args=<optimized out>) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.cpp:129
#45 0x00007ffff34e6379 in __morestack ()
   from /home/keegan/proj/servo/servo/build/src/compiler/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so
#46 0x00007ffff34d5a78 in call_on_c_stack (fn_ptr=0x7ffff34d4ca0, args=0x7fffe83184c0, this=0x7fffe83137b0)
    at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.h:481
#47 task_start_wrapper (a=<optimized out>) at /home/keegan/proj/servo/servo/src/compiler/rust/src/rt/rust_task.cpp:195
#48 0x0000000000000000 in ?? ()
bors-servo pushed a commit that referenced this issue Jul 18, 2013
This does not port the existing src/test/html/ref tests to the new framework, as it appears to me that they aren't really reftests in the sense of Gecko's reftest. This new driver uses the Gecko methodology.

Currently this will pop a window for each test due to not having a headless driver yet, and #570 means that servo segfaults when it shuts down so we can't check the exit status.

There's plenty to improve in the future, but this should get us started.
@kmcallister
Copy link
Contributor

@kmcallister kmcallister commented Jul 23, 2013

The pipeline exit issue is fixed, but Servo still crashes on exit for reasons that seem to be related to this ticket.

@kmcallister
Copy link
Contributor

@kmcallister kmcallister commented Oct 31, 2013

I think this is fixed now.

glennw pushed a commit to glennw/servo that referenced this issue Jan 16, 2017
Fix filename overrides from losing extension

`.with_extension(".glsl")` ends up nuking `.vs` and `.fs`.  Whoops.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/570)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.