Data race in URLPreloader
Categories
(Core :: XPConnect, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox84 | --- | fixed |
People
(Reporter: ytausky, Assigned: Gankra)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 2 obsolete files)
Updated•7 years ago
|
Reporter | ||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Comment 4•6 years ago
|
||
This is still an issue, I will add this to the runtime suppressions until it is fixed.
Assignee | ||
Comment 6•5 years ago
|
||
Turned this off in a try run to see if it's still a problem. It is. Modern stack trace attached.
Assignee | ||
Comment 7•5 years ago
•
|
||
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
oh boy gonna be one of those mornings huh
Assignee | ||
Comment 10•5 years ago
•
|
||
Oh interesting -- this trace is actually slightly different.
The previous trace: NS_NewNamedThread is still writing[0] mReaderThread while the task's (BackgroundReadFiles) cleanup code is reading[1] that value to shut itself down.
The new trace: A new call to BeginBackgroundRead is reading[2] mReaderThread while the task's (BackgroundReadFiles) cleanup code is nulling[1] that value out to indicate it has shut down.
So although the issue with NS_NewNamedThread having a weird initialization order is still an issue, this code is still wrong, because it doesn't synchronize between the task's shutdown and the thing that checks if the task is already running.
It looks like ScriptPreloader might have the same problem, although its self-nulling runs on the main thread[3], which might be sufficient for the new trace, but would still be wrong for the old trace?
I think it would be reasonable to change NS_NewNamedThread to optimistically write the result before kicking off the task, and then have it revert the write if starting the task fails. wdyt?
Assignee | ||
Comment 11•5 years ago
|
||
Nika has recommend just removing the "initial task" convenience as a footgun. I'm going to move forward with that solution unless someone objects.
Assignee | ||
Comment 12•5 years ago
•
|
||
Kris has volunteered to go on an Editing 60 Call Sites Adventure.
Assignee | ||
Comment 13•5 years ago
|
||
The shutdown code of BackgroundReadFiles races with BeginBackgroundRead.
This is paritally obfuscated by the usage of the initialEvent convenience
of NS_NewNamedThread, so this change also removes that in favour of explicit
dispatch. (xpcom devs want to remove the convenience anyway)
Assignee | ||
Comment 14•5 years ago
|
||
Realized the aforementioned "Editing 60 Call Sites" isn't needed to fix this single usage, so here's the fix.
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Description
•