You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deadlock when removing iframe from document. #11546
(gdb) bt
#0 0x00007ffff59db98d in recvmsg () at ../sysdeps/unix/syscall-template.S:84
#1 0x0000555558a8ae62 in ipc_channel::platform::linux::{{impl}}::recv (self=0x7fffe89f6f98, fd=70, blocking_mode=Blocking)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:923
#2 0x0000555558a7b7d5 in ipc_channel::platform::linux::recv (fd=70, blocking_mode=Blocking)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:761
#3 0x0000555558a79840 in ipc_channel::platform::linux::{{impl}}::recv (self=0x7fffe89f7d38)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:86
#4 0x0000555557c21a3f in ipc_channel::ipc::{{impl}}::recv<()> (self=0x7fffe89f7d38)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/ipc.rs:73
#5 0x0000555557c214da in constellation::pipeline::{{impl}}::exit (self=0x7fffe89f7cd8) at /home/emilio/projects/moz/servo/components/constellation/pipeline.rs:326
#6 0x0000555555b7a6cb in constellation::constellation::{{impl}}::close_pipeline<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread>
(self=0x7fffe89fc5e0, pipeline_id=..., exit_mode=Normal) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:1934
#7 0x0000555555b7b865 in constellation::constellation::{{impl}}::close_frame<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread> (
self=0x7fffe89fc5e0, frame_id=..., exit_mode=Normal) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:1874
#8 0x0000555555c988f6 in constellation::constellation::{{impl}}::handle_remove_iframe_msg<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread> (self=0x7fffe89fc5e0, pipeline_id=...) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:1448
#9 0x0000555555c860a5 in constellation::constellation::{{impl}}::handle_request_from_script<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread> (self=0x7fffe89fc5e0, message=...) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:718
#10 0x0000555555b00711 in constellation::constellation::{{impl}}::handle_request<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread>
(self=0x7fffe89fc5e0) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:526
#11 0x0000555555afa986 in constellation::constellation::{{impl}}::run<script::layout_interface::Msg,layout::layout_thread::LayoutThread,script::script_thread::ScriptThread> (
self=0x7fffe89fc5e0) at /home/emilio/projects/moz/servo/components/constellation/constellation.rs:390
#12 0x0000555555ae1278 in _$LT$constellation..constellation..Constellation$LT$Message$C$$u20$LTF$C$$u20$STF$GT$$GT$::start::_$u7b$$u7b$closure$u7d$$u7d$::haaf81ac912498c19 ()
at ../src/libstd/panicking.rs:232
Iframe's ScriptThread
It seems to be blocking in HTMLIFrameElement::unbind_from_tree(), waiting for the constellation.
(gdb) bt
#0 0x00007ffff59db98d in recvmsg () at ../sysdeps/unix/syscall-template.S:84
#1 0x0000555558a8ae62 in ipc_channel::platform::linux::{{impl}}::recv (self=0x7fffe57f5d38, fd=69, blocking_mode=Blocking)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:923
#2 0x0000555558a7b7d5 in ipc_channel::platform::linux::recv (fd=69, blocking_mode=Blocking)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:761
#3 0x0000555558a79840 in ipc_channel::platform::linux::{{impl}}::recv (self=0x7fffe57f64a4)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/platform/linux/mod.rs:86
#4 0x0000555556ea1d8f in ipc_channel::ipc::{{impl}}::recv<()> (self=0x7fffe57f64a4)
at /home/emilio/projects/moz/servo/.cargo/git/checkouts/ipc-channel-8c79851162410a92/master/ipc.rs:73
#5 0x0000555556ea15ca in script::dom::htmliframeelement::{{impl}}::unbind_from_tree (self=0x7fffeae27000, context=0x7fffe57f68e8)
at /home/emilio/projects/moz/servo/components/script/dom/htmliframeelement.rs:581
#6 0x0000555556f2a89d in script::dom::node::{{impl}}::remove_child (self=0x7fffe52e3600, child=0x7fffeae27000, cached_index=...)
at /home/emilio/projects/moz/servo/components/script/dom/node.rs:288
#7 0x0000555556f2f755 in script::dom::node::{{impl}}::remove (node=0x7fffeae27000, parent=0x7fffe52e3600, suppress_observers=Unsuppressed)
at /home/emilio/projects/moz/servo/components/script/dom/node.rs:1627
#8 0x0000555556f38243 in script::dom::node::{{impl}}::pre_remove (child=0x7fffeae27000, parent=0x7fffe52e3600) at /home/emilio/projects/moz/servo/components/script/dom/node.rs:1597
#9 0x00005555569c4884 in script::dom::node::{{impl}}::RemoveChild (self=0x7fffe52e3600, node=0x7fffeae27000) at /home/emilio/projects/moz/servo/components/script/dom/node.rs:2131
#10 0x00005555569c4577 in script::dom::bindings::codegen::Bindings::NodeBinding::removeChild (cx=0x7fffe52e0600, _obj=..., this=0x7fffe52e3600, args=0x7fffe57f6f40)
at /home/emilio/projects/moz/servo/target/debug/build/script-5bfa5fd924db7653/out/Bindings/NodeBinding.rs:1237
#11 0x00005555572d2f1c in CallJitMethodOp ()
It seems in Pipeline::exit() the constellation is sending a ConstellationControlMsg to itself, then waiting to the effect of processing that message, which results in a deadlock, since it's already processing the first message.
The underlying problem is having the constellation block on anything other than the main event loop is a really bad idea, since it means a deadlocked pipeline can cause the whole constellation to deadlock.
@larsbergstrom points out that synchronous shutdown is needed b/c "the graphics stack and spidermonkey behave really badly if they aren't the 'last' things to shutdown, as they're hiding a bunch of native resources."
Activity
emilio commentedon Jun 1, 2016
Some backtraces of affected threads:
Constellation
Constellation is waiting on
Pipeline::exit().Iframe's ScriptThread
It seems to be blocking in
HTMLIFrameElement::unbind_from_tree(), waiting for the constellation.emilio commentedon Jun 1, 2016
It seems in
Pipeline::exit()the constellation is sending aConstellationControlMsgto itself, then waiting to the effect of processing that message, which results in a deadlock, since it's already processing the first message.asajeffrey commentedon Jun 1, 2016
IRC chat: http://logs.glob.uno/?c=mozilla%23servo&s=1+Jun+2016&e=1+Jun+2016#c445507
asajeffrey commentedon Jun 1, 2016
The underlying problem is having the constellation block on anything other than the main event loop is a really bad idea, since it means a deadlocked pipeline can cause the whole constellation to deadlock.
asajeffrey commentedon Jun 1, 2016
OK, looking through the constellation code, the uses of
recvin constellation.rs are:I think these are all OK, we certainly want to block on the main event loop and exit, it doesn't matter if reftests deadlock because that'll show up in testing, and there is a comment (https://github.com/servo/servo/blob/master/components/compositing/compositor.rs#L130) that the compositor never blocks on the constellation.
Now to check pipeline.rs and compositor.rs...
asajeffrey commentedon Jun 1, 2016
Over in pipeline.rs, the uses of
recvare:exitwhich caused this deadlock (https://github.com/servo/servo/blob/master/components/constellation/pipeline.rs#L326)start_allcode (https://github.com/servo/servo/blob/master/components/constellation/pipeline.rs#L462) which is called in two places:false, so it doesn't blockSo it looks like the only problematic ones in pipeline.rs are the ones in
Pipeline::exit.asajeffrey commentedon Jun 1, 2016
And in compositor.rs, the uses of
recvare:finish_shutting_down, waiting for the profiler to shut down (https://github.com/servo/servo/blob/master/components/compositing/compositor.rs#L540)repaint_synchronously, which (as the name suggests) is synchronous (https://github.com/servo/servo/blob/master/components/compositing/compositor.rs#L2574)These are both dangerous, but it looks like they can't cause deadlocks, that the "blocks-on" relationship is acyclic.
asajeffrey commentedon Jun 1, 2016
IRC chat: http://logs.glob.uno/?c=mozilla%23servo&s=1+Jun+2016&e=1+Jun+2016#c445562
@larsbergstrom points out that synchronous shutdown is needed b/c "the graphics stack and spidermonkey behave really badly if they aren't the 'last' things to shutdown, as they're hiding a bunch of native resources."
emilio commentedon Jun 1, 2016
Moar IRC: http://logs.glob.uno/?c=mozilla%23servo&s=1+Jun+2016&e=1+Jun+2016#c445687
asajeffrey commentedon Jun 2, 2016
A possible fix: https://github.com/asajeffrey/servo/tree/constellation-avoid-deadlock-during-shutdown
Auto merge of #11585 - asajeffrey:constellation-avoid-deadlock-during…
Auto merge of #11585 - asajeffrey:constellation-avoid-deadlock-during…
Auto merge of #11585 - asajeffrey:constellation-avoid-deadlock-during…