Closed Bug 1308404 Opened 9 years ago Closed 9 years ago

drop LocalStyleContexts before XPCOM shutdown

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: heycam, Unassigned)

References

Details

Each StyleWorker thread has a LocalStyleContext stored in TLS. These don't get cleared, and they end up getting destroyed very late, under exit(). This is after XPCOM shutdown, and the Gecko style structs stored in the LocalStyleContext's applicable declaration cache hold on to XPCOM things like nsIAtoms, so we should try to release them earlier so that we don't throw assertions on shutdown. I guess we should do this under Servo_Shutdown. #17 0x00007f0b7d5fddf9 in ah_crap_handler (signum=11) at /z/stylo/incubator/toolkit/xre/nsSigHandlers.cpp:92 #18 0x00007f0b7d5da64f in nsProfileLock::FatalSignalHandler (signo=11, info=0x7ffd29289bf0, context=0x7ffd29289ac0) at /z/stylo/incubator/toolkit/profile/nsProfileLock.cpp:191 #19 <signal handler called> #20 0x00007f0b780359bc in NS_LogCOMPtrRelease (aCOMPtr=0x7f0b3bd853d0, aObject=0x7f0b6a659bb0) at /z/stylo/incubator/xpcom/base/nsTraceRefcnt.cpp:1275 #21 0x00007f0b78071f44 in nsCOMPtr<nsIAtom>::~nsCOMPtr (this=0x7f0b3bd853d0) at /z/stylo/incubator/obj/dist/include/nsCOMPtr.h:402 #22 0x00007f0b7c5ed661 in nsStyleFont::~nsStyleFont (this=0x7f0b3bd85360) at /z/stylo/incubator/layout/style/nsStyleStruct.h:168 #23 0x00007f0b7c5c5285 in Gecko_Destroy_nsStyleFont (ptr=0x7f0b3bd85360) at /z/stylo/incubator/obj/layout/style/nsStyleStructList.h:44 #24 0x00007f0b7f4b550b in {{inlined-root}}::drop_slow<style::gecko_properties::GeckoFont> (self=0x7f0b3ed54cc8) at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/liballoc/arc.rs:321 #25 0x00007f0b7f538d2d in drop::hfe30b2c92d993ced () at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:710 #26 0x00007f0b7f4b4bab in {{inlined-root}}::drop_slow<style::gecko_properties::ComputedValues> (self=0x7f0b4dd80018) at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/liballoc/arc.rs:321 #27 0x00007f0b7f52f3b8 in drop::h2f24e4f53ce13e70 () at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:710 #28 0x00007f0b7f5525ee in {{inlined-root}}::drop<core::option::Option<(style::matching::ApplicableDeclarationsCacheEntry, alloc::arc::Arc<style::gecko_properties::ComputedValues>)>> (self=0x7f0b4a86dd18) at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1606 #29 0x00007f0b7f52f4be in drop::h309270fb2dde51f2 () at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:710 #30 0x00007f0b7f533abe in drop::h957e555138a89558 () at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:710 #31 0x00007f0b7f54c11f in {{inlined-root}}::drop<style::context::LocalStyleContext> (self=0x7f0b8c267350) at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/liballoc/rc.rs:458 #32 0x00007f0b8c4ce5ef in __call_tls_dtors () from /lib/x86_64-linux-gnu/libc.so.6 #33 0x00007f0b8c4cdf17 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #34 0x00007f0b8c4ce035 in exit () from /lib/x86_64-linux-gnu/libc.so.6 #35 0x00007f0b8c4b4837 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 #36 0x00000000004053e9 in _start ()
And when testing in STYLO_THREADS=1 mode, I guess the LocalStyleContext is stored in TLS on the main thread.
I think this was just due to not correctly dropping the PerDocumentStyleData, which is being fixed in https://github.com/servo/servo/pull/13692.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.