nsThreadPool: Make sure we drain all events correctly on shutdown
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
People
(Reporter: jstutte, Assigned: jstutte)
References
Details
Attachments
(2 obsolete files)
Once a thread pool is asked to shutdown, it will refuse to accept any further events even if those come from a thread running inside the same pool while we are draining the remaining events (the loop continues until there are events). That means, that any processing that relies on a sequence of
- "A on other thread dispatches B to the pool"
- "B runs on pool and dispatches C to the same pool"
- "C runs on pool and dispatches D to original thread to resolve some promise/close some callback roundtrip/whatever"
would break, if the pool is asked to shutdown after 1. but before 2. I think it is worth filing a bug to rule this out.
The above sequence would happen for example if a TaskQueue that refers to that pool has still events in its internal queue when the pool is asked to shutdown. We would want TaskQueues to shutdown before the pools, but there is probably not a too easy way to enforce this, so we want to be resilient.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
I think this would be complementary to this check in TaskQueue, as the dispatch would most likely go through a task queue.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 3•1 year ago
|
||
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
We discussed this shortly (again) in the XPCOM meeting and while this patch would increase consistency with the behavior of a single nsThread during shutdown, it might create a subtle footgun for events that actually expect to dispatch and run something in parallel while we disallow the creation of new threads.
Given there is no known problem this would solve, we prefer to keep the evident way of failing the dispatch always which forces consumers to be mindful about shutdown.
Description
•