Closed Bug 1398393 Opened 7 years ago Closed 7 years ago

Rust panic when using Stylo with Quantum DOM threads

Categories

(Core :: DOM: Content Processes, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

Attachments

(1 file)

With dom.ipc.scheduler and layout.css.servo.enabled set to true, we get a rust panic pretty early on in startup:

thread '<unnamed>' panicked at 'assertion failed: thread_state::get() == thread_state::LAYOUT', /home/mrbkap/work/main/mozilla/servo/components/style/context.rs:789:8

The problem appears to be that on the true main thread we call Servo_Initialize [1] in order to do some debug verification, set up the global logger, set some global state, and importantly for this bug, set the "thread state" in the thread local data.

It seems like the easiest fix would be to add a way for cooperative threads to set the Rust thread state, but I'm pretty new to this code so I'm open to alternative fixes.

[1] http://searchfox.org/mozilla-central/rev/d29c832536839b60a9ee5b512eeb934274b879b0/servo/ports/geckolib/glue.rs#157
Assignee: nobody → mrbkap
Comment on attachment 8906176 [details]
Bug 1398393 - Set Servo thread state on cooperative threads.

https://reviewboard.mozilla.org/r/177922/#review186730

::: xpcom/threads/CooperativeThreadPool.cpp:160
(Diff revision 1)
>  
>    nsCString name = mPool->mThreadNaming.GetNextThreadName("Main");
>    PR_SetCurrentThreadName(name.get());
>  
>    mozilla::IOInterposer::RegisterCurrentThread();
> +  Servo_InitializeCooperativeThread();

Can we put this somewhere in here?
http://searchfox.org/mozilla-central/rev/1c13d5cf85f904afb8976c02a80daa252b893fca/xpcom/threads/Scheduler.cpp#630-656
Attachment #8906176 - Flags: review?(wmccloskey) → review+
I created https://github.com/servo/servo/pull/18569 for the servo/ bit.
Pushed by mrbkap@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/785910c8bee7
Set Servo thread state on cooperative threads. r=billm
https://hg.mozilla.org/mozilla-central/rev/785910c8bee7
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: