When throttling is enabled, service worker requests are never shown as completed
Categories
(DevTools :: Netmonitor, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned, NeedInfo)
References
(Blocks 1 open bug)
Details
Spotted while working on https://bugzilla.mozilla.org/show_bug.cgi?id=1880803
The issue is actually not linked to throttling, but it's a side-effect of creating the httpActivity early when throttling is enabled here
if (throttler) {
const channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (this.#ignoreChannelFunction(channel)) {
return;
}
logPlatformEvent("http-on-modify-request", channel);
// Read any request body here, before it is throttled.
const httpActivity = this.#createOrGetActivityObject(channel);
this.#prepareRequestBody(httpActivity);
throttler.manageUpload(channel);
}
The channel object we have at this point is actually different from the one we will get later in "http-on-examine-cached-response" (here). But they share the same channelId
, and since our ChannelMap fully relies on channel ids, creating the activity earlier means we will use a stale channel object. After that, we fail to setup the response listener with
Handler function threw an exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsITraceableChannel.setNewListener]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: resource://devtools/shared/network-observer/NetworkObserver.sys.mjs :: #setupResponseListener :: line 1015" data: no]
Reporter | ||
Comment 1•2 months ago
|
||
Hi Valentin, do you know offhand if it's expected that the channel object for a service worker request can change while keeping the same channel id?
When redirecting to an intercepted channel we seem to be using the same channelId for the intercepted channel:
https://searchfox.org/mozilla-central/rev/1f46481d6c16f27c989e72b898fd1fddce9f445f/netwerk/protocol/http/nsHttpChannel.cpp#10357-10359
nsresult rv = intercepted->Init(
mURI, mCaps, static_cast<nsProxyInfo*>(mProxyInfo.get()),
mProxyResolveFlags, mProxyURI, mChannelId, type, redirectLoadInfo);
Should we be generating a different channelId for the new intercepted channel?
Reporter | ||
Comment 3•2 months ago
|
||
(In reply to Valentin Gosu [:valentin] (he/him) from comment #2)
When redirecting to an intercepted channel we seem to be using the same channelId for the intercepted channel:
https://searchfox.org/mozilla-central/rev/1f46481d6c16f27c989e72b898fd1fddce9f445f/netwerk/protocol/http/nsHttpChannel.cpp#10357-10359nsresult rv = intercepted->Init( mURI, mCaps, static_cast<nsProxyInfo*>(mProxyInfo.get()), mProxyResolveFlags, mProxyURI, mChannelId, type, redirectLoadInfo);
Should we be generating a different channelId for the new intercepted channel?
Thanks for checking! I think we want to keep the same channelId, otherwise our tools would start showing two requests in this case. We need to find a way to handle this gracefully. Maybe we need to revisit our map caching httpActivity obejcts per channel.
Description
•