nsSyncStreamListener drops error status when waiting for data
Categories
(Core :: Networking, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: neil, Assigned: CuveeHsu)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 file)
This bug seems to have been present in nsSyncStreamListener
since it was originally added by bug 192284.
https://searchfox.org/mozilla-central/source/netwerk/base/nsSyncStreamListener.cpp#117
mStatus
is set as the result of an OnStopRequest
call. If this happens before the call to Available
, then the status is returned as expected. If however Available
starts waiting for data, it overwrites the status with the return value from WaitForData
, which is usually NS_OK
.
My guess as to the easiest way to fix this is to make WaitForData
return mStatus
on success.
Comment 1•5 years ago
|
||
Junior, could you take a look at this?
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Hello neil,
Sorry for missing this.
Did you worry about this sequence?
listener->OnStopRequest()
-> mStatus
is set by parameter
then listener->Available()
-> mStatus
is set to NS_OK
However IMO mStatus
won't change by Available
in this case since we bailed out for failure
https://searchfox.org/mozilla-central/rev/201450283cddc9e409cec707acb65ba6cf6037b1/netwerk/base/nsSyncStreamListener.cpp#116
And nSyncStreamListener
is single thread object. No race condition happened.
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 3•5 years ago
|
||
(In reply to Junior from comment #2)
Hello neil,
Sorry for missing this.
Sorry for overlooking your response!
Did you worry about this sequence?
listener->OnStopRequest()
->mStatus
is set by parameter
thenlistener->Available()
->mStatus
is set toNS_OK
However IMO
mStatus
won't change byAvailable
in this case since we bailed out for failure
https://searchfox.org/mozilla-central/rev/201450283cddc9e409cec707acb65ba6cf6037b1/netwerk/base/nsSyncStreamListener.cpp#116And
nSyncStreamListener
is single thread object. No race condition happened.
WaitForData()
calls SpinEventLoopUntil
, which means that an event can call listener->OnStopRequest()
after the check for failure but before listener->Available()
sets mStatus
back to NS_OK
.
Assignee | ||
Comment 4•4 years ago
|
||
Assignee | ||
Comment 5•4 years ago
•
|
||
Pushed by juhsu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6b3d6a63e8c4 avoid hiding error in nsSyncStreamListener r=michal
Comment 7•4 years ago
|
||
bugherder |
Description
•