Closed Bug 122675 Opened 23 years ago Closed 23 years ago

socket transport doesn't cancel properly if busy resolving or connecting

Categories

(Core :: Networking, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: darin.moz, Assigned: darin.moz)

References

Details

Attachments

(1 file)

i discovered several problems with the socket transport / dns service when mozilla is run on a system that cannot reach its DNS server. the problem is mostly XP, with a specific problem in the XP_UNIX DNS service impl. steps to repro: 1) disconnect ethernet cable 2) load www.mozilla.org 3) status bar reads "resolving www.mozilla.org" 4) press stop 5) status bar reads "Document: done" 6) load www.mozilla.org again 7) status bar still reads "Document: done", but throbber indicates browser is busy. what's going on? it turns out that the first request for www.mozilla.org is not being canceled completely. the DNS request is still active, and the socket transport for the first request has not fired OnStopRequest. as a result, the first request has not closed its cache entry. the subsequent request gets blocked waiting for the cache service to give it access to the cache entry for www.mozilla.org. ok, so what if we try loading a different host subsequently? 0) restart mozilla 1) disconnect ethernet cable 2) load www.mozilla.org 3) status bar reads "resolving www.mozilla.org" 4) press stop 5) status bar reads "Document: done" 6) load www.mozillazine.org 7) status bar still reads "Document: done", but throbber indicates browser is busy. ok, now what? this time, the subsequent request was able to access the cache entry for www.mozillazine.org, but it still didn't report that it was resolving www.mozillazine.org. turns out that socket transport thread is actually stuck waiting to access the DNS service lock. the problem being that the DNS service holds its lock while calling gethostbyname, and gethostbyname blocks until it times out. if i modify the code to exit the lock before calling gethostbyname and then re-enter the lock after gethostbyname returns, the problem is almost solved. it turns out that the first example of reloading www.mozilla.org still fails because i still haven't solved the problem of OnStopRequest not being fired until the DNS request times out... despite the fact that the user canceled the request. this points to a flaw in the socket transport. cancel is not causing the DNS request to be canceled. in fact, a socket transport log reveals that we are actually issuing a new DNS request instead of processing the cancelation. in fact, after reading the code, it appears that there is no code in place to handle cancelation during the resolve and connect steps. this can be fixed by checking the status of mReadRequest and mWriteRequest at the top of nsSocketTransport::Process. patch in hand.
Severity: normal → critical
Status: NEW → ASSIGNED
Keywords: mozilla0.9.9
Priority: -- → P1
Target Milestone: --- → mozilla0.9.9
Attached patch v1.0 patchSplinter Review
gordon: can you review this patch? thx!
Comment on attachment 67227 [details] [diff] [review] v1.0 patch I think this looks good. I thought about moving the unlocking of the dns service to a different spot, but I think it best left where you have it. r=gordon.
Attachment #67227 - Flags: review+
Comment on attachment 67227 [details] [diff] [review] v1.0 patch sr=mscott
Attachment #67227 - Flags: superreview+
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 123163 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: