Closed
Bug 1399646
Opened 7 years ago
Closed 7 years ago
Fix shutdown issues with StreamFilters in use (and otherwise)
Categories
(WebExtensions :: Request Handling, defect, P1)
WebExtensions
Request Handling
Tracking
(firefox57 affected)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox57 | --- | affected |
People
(Reporter: kmag, Assigned: kmag)
References
Details
Attachments
(4 files)
There are currently some shutdown issues when StreamFilters in a child process are active for requests in the parent.
The main issue is that the combination of the BackgroundPageThumbs service running during shutdown along with unexpected reentrancy in the service worker registrar tends to cause deadlocks at shutdown for short sessions (as triggered by ts_paint tests). That results in the process being killed before it gets passed the profile-before-change shutdown phase, and the background threads therefore shutting down before the actors have had a chance to clean up after themselves.
Aside from that, we don't do a particularly good job of making sure StreamFilter instances are closed as soon as possible after the page they belong to is closed. There are probably more elegant ways we should handle that, but my current solution is to disconnect the actor as soon as we try to dispatch an event to a page that has scriptability blocked.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8907847 [details]
Bug 1399646: Part 1 - Destroy BackgroundPageThumbs instance at shutdown.
https://reviewboard.mozilla.org/r/179534/#review184720
::: commit-message-43d65:8
(Diff revision 1)
> +Calling the (currently unused) _destroy() method at the start of shutdown
> +seems to prevent the majority of these problems.
Doesn't look unused:
https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/browser-test.js#634
Does that mean we should be removing that callsite?
Attachment #8907847 -
Flags: review?(gijskruitbosch+bugs)
Assignee | ||
Comment 6•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8907847 [details]
Bug 1399646: Part 1 - Destroy BackgroundPageThumbs instance at shutdown.
https://reviewboard.mozilla.org/r/179534/#review184720
> Doesn't look unused:
>
> https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/browser-test.js#634
>
>
> Does that mean we should be removing that callsite?
Hm. I couldn't find any uses of it, but I didn't check tests.
But, no, I don't think we should remove that call site, since it's there to prevent false positive window leak failures for windows created by the background thumbs service. I think the shutdown observer happens too late to handle that.
But the `_destroy()` method can handle being called multiple times, so I don't think having both is a problem.
Comment 7•7 years ago
|
||
mozreview-review |
Comment on attachment 8907847 [details]
Bug 1399646: Part 1 - Destroy BackgroundPageThumbs instance at shutdown.
https://reviewboard.mozilla.org/r/179534/#review184726
OK, then let's do it.
Attachment #8907847 -
Flags: review+
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8907850 [details]
Bug 1399646: Part 4 - Increase the extension shutdown blocker timeout.
https://reviewboard.mozilla.org/r/179540/#review184732
Attachment #8907850 -
Flags: review?(mixedpuppy) → review+
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8907849 [details]
Bug 1399646: Part 3 - Improve handling of StreamFilters at shutdown.
https://reviewboard.mozilla.org/r/179538/#review184734
I'm not familiar with xpc::Scriptability, but what you're doing looks reasonable.
Attachment #8907849 -
Flags: review?(mixedpuppy) → review+
Assignee | ||
Comment 10•7 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/8220fde3db60b243e9d8b8abd82562bb31509deb
Bug 1399646: Part 1 - Destroy BackgroundPageThumbs instance at shutdown. r=Gijs
https://hg.mozilla.org/integration/mozilla-inbound/rev/f87e1d6810536ab0dc940f95563869d86aa937d3
Bug 1399646: Part 3 - Improve handling of StreamFilters at shutdown. r=mixedpuppy
https://hg.mozilla.org/integration/mozilla-inbound/rev/c7c638b31626ace9d0951e7a69450615673c9656
Bug 1399646: Part 4 - Increase the extension shutdown blocker timeout. r=mixedpuppy
Assignee | ||
Comment 11•7 years ago
|
||
The three parts I pushed should be enough to fix most of the talos failures, but there will probably be intermittents until the last part lands.
Keywords: leave-open
Comment 12•7 years ago
|
||
bugherder |
Comment 13•7 years ago
|
||
mozreview-review |
Comment on attachment 8907848 [details]
Bug 1399646: Part 2 - Use the async shutdown service for ServiceWorkerRegistrar.
https://reviewboard.mozilla.org/r/179536/#review184924
::: dom/workers/ServiceWorkerRegistrar.cpp:1029
(Diff revision 1)
> }
>
> + rv = GetShutdownPhase()->AddBlocker(
> + this, NS_LITERAL_STRING(__FILE__), __LINE__,
> + NS_LITERAL_STRING("ServiceWorkerRegistrar"));
> + MOZ_ASSERT(NS_SUCCEEDED(rv));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
::: dom/workers/ServiceWorkerRegistrar.cpp:1080
(Diff revision 1)
> +}
> +
> +NS_IMETHODIMP
> +ServiceWorkerRegistrar::GetName(nsAString& aName)
> +{
> + aName = NS_LITERAL_STRING("ServiceWorkerRegistar");
This should be "ServiceWorkerRegistrar: Flushing data" or anything with a meaning.
::: dom/workers/ServiceWorkerRegistrar.cpp:1099
(Diff revision 1)
> + MOZ_RELEASE_ASSERT(svc);
>
> - MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() { return completed; }));
> + nsCOMPtr<nsIAsyncShutdownClient> client;
> + Unused << svc->GetProfileBeforeChange(getter_AddRefs(client));
> + MOZ_RELEASE_ASSERT(client);
> + return Move(client);
Is Move(client) equal to client.forget() ? I guess so.
Attachment #8907848 -
Flags: review?(amarchesini) → review+
Assignee | ||
Comment 14•7 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/4890481365e66c1ef2f7126481908b64002c113f
Bug 1399646: Part 2 - Use the async shutdown service for ServiceWorkerRegistrar. r=baku
Comment 15•7 years ago
|
||
bugherder |
Updated•7 years ago
|
status-firefox57:
--- → affected
Updated•7 years ago
|
Priority: -- → P1
Updated•7 years ago
|
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•