Bug 1619213 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I think the problem is the AutoRunParallelWork in unmarkCollectedZones keeps holding the lock
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/GC.cpp#4006

so JS Helpers aren't run because they cannot acquire the lock.

And when unmarkCollectedZones exits, the destructor of AutoRunParallelWork calls joinTask
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/ParallelWork.h#103

and because those tasks are not run by helpers, so main thread runs them
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/GC.cpp#5031
The stack trace in Comment 0 also explains this.

And because it's only main thread runs the task, it takes a long time, and as Gabriele explains in comment 2, the timer kills it
(Thanks Gabriels)

So I will try to fix this 
1. AutoRunParallelWork will only take the lock when it needs to, so it could release the lock earlier.
2. add another joinTask() that won't run the task by main thread. (or maybe add another condition, say main thread will run the task if helper threads are all busy)
I think the problem is the AutoRunParallelWork in unmarkCollectedZones keeps holding the lock
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/GC.cpp#4006

so JS Helpers aren't run because they cannot acquire the lock.

And when unmarkCollectedZones exits, the destructor of AutoRunParallelWork calls joinTask
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/ParallelWork.h#103

and because those tasks are not run by helpers, so main thread runs them
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/js/src/gc/GC.cpp#5031
The stack trace in Comment 0 also explains this.

And because it's only main thread runs the task, it takes a long time, and as Gabriele explains in comment 2, the timer kills it
(Thanks Gabriels)

So I will try to fix this with adding another joinTask() that won't run the task by main thread. (or maybe add another condition, say main thread will run the task if helper threads are all busy)

Back to Bug 1619213 Comment 5