Closed
Bug 1502055
Opened 7 years ago
Closed 7 years ago
nsHttpChannel crash with ClearSiteData header if the server returns 304
Categories
(Core :: Networking: HTTP, defect, P2)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla65
| Tracking | Status | |
|---|---|---|
| firefox65 | --- | fixed |
People
(Reporter: baku, Assigned: mayhemer)
References
Details
(Whiteboard: [necko-triaged])
Attachments
(3 files, 3 obsolete files)
|
16.04 KB,
application/x-bzip
|
Details | |
|
9.18 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
|
3.64 KB,
patch
|
mayhemer
:
review+
|
Details | Diff | Splinter Review |
The crash is because of this assertion:
https://searchfox.org/mozilla-central/rev/72b1e834f384a2ffec6eb4ce405fbd4b5e881109/netwerk/protocol/http/nsHttpChannel.cpp#7342
STR:
1. we have a server which sends a 304 + ClearSiteData header for a request already in the necko cache
2. ClearSiteData service suspends the channel during the cleanup - the cleanup doesn't touch the necko cache. ClearSiteData header contains 'storage'.
3. after the cleanup the channel is resumed
4. OnStartRequest crashes.
| Reporter | ||
Comment 1•7 years ago
|
||
Updated•7 years ago
|
Assignee: nobody → michal.novotny
Priority: -- → P3
Whiteboard: [necko-triaged]
| Assignee | ||
Comment 2•7 years ago
|
||
Regression likely from bug 1396395.
What happens here is:
- in nsHttpChannel::ContinueProcessResponse1 we are suspended (from an on-modify handler), so we schedule nsHttpChannel::ContinueProcessResponse1 be called on resume
- this holds the OnStopRequest call from transaction (where we release the transaction) from being fired (transaction is suspended)
- ResumeInternal is called, which:
- drops the suspend cntr to zero
- schedules a runnable to [1]:
- call nsHttpChannel::ContinueProcessResponse1 (the mCallOnResume thing), this leads to:
- ReadFromCache()
it creates the cache pump and asyncRead()'s it
OnStartRequest from the cache pump is scheduled
- resumes the network transaction
OnStopRequest from the transaction pump is scheduled
So, in OnStartRequest fired from cache pump we still have mTransactionPump.
Not sure about a fix, tho...
[1] https://searchfox.org/mozilla-central/rev/72b1e834f384a2ffec6eb4ce405fbd4b5e881109/netwerk/protocol/http/nsHttpChannel.cpp#9184
| Assignee | ||
Comment 3•7 years ago
|
||
(sorry Michal, mid air collision)
| Assignee | ||
Updated•7 years ago
|
Assignee: nobody → honzab.moz
| Assignee | ||
Updated•7 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 4•7 years ago
|
||
Baku, could you please refer the original bug with the test case? I would like to check the patch locally with it. Thanks.
Flags: needinfo?(amarchesini)
| Assignee | ||
Comment 5•7 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0e43bbe5f7e8921103a75cc6ee24688914cb3396
When mCallOnResume handler creates a new pump (in the case of this bug it's the cache pump) it is created suspended - the new mAsyncResumePending flag controls that. Then after we called mCallOnResume, we resume previously existing pumps and only after that any newly created pumps.
Note that I lost the bug# with a STR, so not tested for that case.
Attachment #9020608 -
Flags: review?(dd.mozilla)
Updated•7 years ago
|
Attachment #9020608 -
Flags: review?(dd.mozilla) → review+
| Assignee | ||
Comment 7•7 years ago
|
||
Thanks for the review! Now it's pending a test from :baku.
Flags: needinfo?(amarchesini)
| Reporter | ||
Comment 8•7 years ago
|
||
This triggers the crash without your patch.
Flags: needinfo?(amarchesini)
Attachment #9020736 -
Flags: review?(honzab.moz)
| Assignee | ||
Comment 9•7 years ago
|
||
Comment on attachment 9020736 [details] [diff] [review]
crash.patch
Review of attachment 9020736 [details] [diff] [review]:
-----------------------------------------------------------------
thanks so much for this!
::: netwerk/test/mochitests/file_1502055.sjs
@@ +11,5 @@
> + response.write('<html><body>Hello world!</body></html>');
> + setState('count', '1');
> + return;
> + }
> +
nit: tws
Attachment #9020736 -
Flags: review?(honzab.moz) → review+
| Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
| Reporter | ||
Comment 10•7 years ago
|
||
Attachment #9020736 -
Attachment is obsolete: true
Comment 11•7 years ago
|
||
| bugherder landing | ||
https://hg.mozilla.org/integration/mozilla-inbound/rev/c0cf2301443d
https://hg.mozilla.org/integration/mozilla-inbound/rev/c5317de7cf01
Flags: in-testsuite+
Keywords: checkin-needed
Comment 12•7 years ago
|
||
Backed out 2 changesets (Bug 1502055) for mochitest failures on test_1502055.html
Backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/9fe7380322a2bad3b6d67bb398a17efa9dd5819f
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&resultStatus=pending%2Crunning%2Csuccess%2Ctestfailed%2Cbusted%2Cexception&revision=c5317de7cf018c2e00fc67d0db3f0c45fd6a1483&selectedJob=208399101
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=208399101&repo=mozilla-inbound&lineNumber=3283
Flags: needinfo?(honzab.moz)
| Assignee | ||
Comment 13•7 years ago
|
||
baku's test -> ni
Flags: needinfo?(honzab.moz) → needinfo?(amarchesini)
| Assignee | ||
Comment 14•7 years ago
|
||
note that the try push of the code changes is fully green.
| Reporter | ||
Comment 15•7 years ago
|
||
Actually, it's the fix that doesn't work. See this:
https://treeherder.mozilla.org/logviewer.html#?job_id=208398960&repo=mozilla-inbound
Assertion failure: mRaceCacheWithNetwork || !(mTransactionPump && mCachePump) || mCachedContentIsPartial (If we have both pumps, the cache content must be partial), at /builds/worker/workspace/build/src/netwerk/protocol/http/nsHttpChannel.cpp:7379
We still crash there.
Flags: needinfo?(amarchesini) → needinfo?(honzab.moz)
| Assignee | ||
Comment 16•7 years ago
|
||
(In reply to Andrea Marchesini [:baku] from comment #15)
> Actually, it's the fix that doesn't work. See this:
> https://treeherder.mozilla.org/logviewer.html#?job_id=208398960&repo=mozilla-
> inbound
>
> Assertion failure: mRaceCacheWithNetwork || !(mTransactionPump &&
> mCachePump) || mCachedContentIsPartial (If we have both pumps, the cache
> content must be partial), at
> /builds/worker/workspace/build/src/netwerk/protocol/http/nsHttpChannel.cpp:
> 7379
>
> We still crash there.
Ah! Thanks. I though you ran the test and it DID pass for the original problem. OK, interesting, I will look into this. It's so convenient now when we have an actual test for this :)
| Assignee | ||
Comment 17•7 years ago
|
||
So, it turns out that OnStartRequest from the newly created cache pump is already scheduled, regardless the added Suspend (AsyncRead calls AsyncWait on the stream, suspend is actually handled in OnInputStreamReady, which has not been called until the time we call Resume, and when it is called, the counter is already at 0.)
Hence, instead of some complicated code changes, I rather simply post again to resume the pumps. I think worth another r? round.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cdefcda0405abc63d9c9fbea79ad15b1ba7e9063
Attachment #9020608 -
Attachment is obsolete: true
Flags: needinfo?(honzab.moz)
Attachment #9021482 -
Flags: review?(dd.mozilla)
| Reporter | ||
Comment 18•7 years ago
|
||
This test works fine with patch v2.
Attachment #9020745 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #9021482 -
Flags: review?(dd.mozilla) → review+
| Assignee | ||
Comment 19•7 years ago
|
||
Thanks again! :)
Andrea, do you want to ask for r on the test so we could land it?
Flags: needinfo?(amarchesini)
| Reporter | ||
Updated•7 years ago
|
Flags: needinfo?(amarchesini)
Attachment #9021504 -
Flags: review?(honzab.moz)
| Assignee | ||
Comment 20•7 years ago
|
||
Comment on attachment 9021504 [details] [diff] [review]
test
Review of attachment 9021504 [details] [diff] [review]:
-----------------------------------------------------------------
Works! Thanks.
Attachment #9021504 -
Flags: review?(honzab.moz) → review+
| Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Comment 21•7 years ago
|
||
Pushed by ebalazs@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7517d1d77643
Make nsHttpChannel::ResumeInternal keep order of transaction pump OnStopRequest before cache pump OnStartRequest, r=dragana
https://hg.mozilla.org/integration/mozilla-inbound/rev/7ab5e4dd08b7
test for Clear-Site-Data + 304 http status r=mayhemer
Keywords: checkin-needed
Comment 22•7 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/7517d1d77643
https://hg.mozilla.org/mozilla-central/rev/7ab5e4dd08b7
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•