Calling HelperThreadTaskCallback causes timeout in xpcshell/selftest.py on linux
Categories
(Core :: XPCOM, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: allstars.chh, Assigned: allstars.chh)
References
(Depends on 1 open bug)
Details
Attachments
(2 files)
See my sample patch in https://hg.mozilla.org/try/rev/437f097aeb4ea0d9d46de94025738dfeab714894
it's just calling HelperThreadTaskCallback, however, on linux platform it got timeout when running selftest.py
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bb7493cb49abff71cdb97b57b7b12f17b92b24f3
running the test locally on a linux machine can also reproduce this problem
./mach python-test testing/xpcshell/selftest.py
(It took a while, because most of the tests got timeout)
Kris, do you know this problem when you landed the HelperThreadTaskCallback?
Thanks
Comment 1•5 years ago
|
||
This is the same problem that causes assertions in bug 1632825 and it's related to the way thread pools shut down (bug 1633548). With the pool unable to service tasks if nsThreadManager
isn't making new threads, the event queue gets stuck. Even after it asserts, the thread pool still can't shut down because the event queue is still stuck, so we end up with a hang.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
As it turned out this is not the same problem as in Bug 1632825. I've tried even not to dispatch task to HelperThreadPool after nsThreadManager shutdown, and the situtation is still there.
When nsThreadManager shuts down, it will shutdown all the threads,
including the main thread of HelperThreadPool.
However the main thread of HelperThreadPool has been waiting.
https://searchfox.org/mozilla-central/rev/446160560bf32ebf4cb7c4e25d7386ee22667255/xpcom/threads/nsThreadPool.cpp#277
and nsThreadManager will have to wait until HelperThreadPool wakes up to shutdown the main thread of HelperThreadPool.
I fix this by adding a HelperThreadPoolShutdownObserver to observe the xpcom-shutdown-threads notification, and shut down HelperThreadPool
accordingly.
Assignee | ||
Comment 3•5 years ago
|
||
When nsThreadManager shuts down, it will shutdown all the threads,
including the main thread of HelperThreadPool.
However the main thread of HelperThreadPool has been waiting.
https://searchfox.org/mozilla-central/rev/446160560bf32ebf4cb7c4e25d7386ee22667255/xpcom/threads/nsThreadPool.cpp#277
and nsThreadManager will have to wait until HelperThreadPool wakes up to
shutdown the main thread of HelperThreadPool.
Adding a HelperThreadPoolShutdownObserver to observe the
xpcom-shutdown-threads notification, and shut down HelperThreadPool
accordingly.
Assignee | ||
Comment 4•5 years ago
|
||
After fixing the timeout, I found there's a leak for the RunnableTask
dispatched to HelperThreadPool.
Updated•5 years ago
|
Comment 6•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5a7274adecec
https://hg.mozilla.org/mozilla-central/rev/d00b78d47707
Description
•