Closed
Bug 1311044
Opened 9 years ago
Closed 9 years ago
non-existent Unix domain socket does not produce an error
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla52
| Tracking | Status | |
|---|---|---|
| firefox52 | --- | fixed |
People
(Reporter: mcs, Assigned: xeonchen)
Details
(Whiteboard: [tor][proxy][necko-active])
Attachments
(2 files)
When a Unix domain socket path is configured as a proxy, the underlying connect() error is not propagated up the networking stack. This causes connections to never fail (and of course they will never succeed). Steps to reproduce:
1. Set the following pref values:
* network.proxy.type = 1
* network.proxy.socks = file:///no-such-file
* network.proxy.socks_port = 0
2. Try to open a page, e.g., https://www.mozilla.org/
Expected results: a page load error should be reported.
Actual results: the page stays in the "Connecting" state indefinitely.
Also, if I use dtruss on OSX I see this repeated rapidly:
connect(0x3A, 0x700000936510, 0x6A) = -1 Err#2
(ENOENT is being returned from the connect() system call over and over again).
I will attach a stacktrace.
| Reporter | ||
Comment 1•9 years ago
|
||
This bug makes a Unix domain socket proxy unusable for Tor because the firefox process hangs during exit if any network activity is ongoing. Why? Because during browser shutdown the tor proxy daemon is killed, which causes the Unix domain socket to disappear -- but Firefox continues to try to use the non-existent socket.
Assignee: nobody → xeonchen
Whiteboard: [tor][proxy]
| Assignee | ||
Updated•9 years ago
|
Whiteboard: [tor][proxy] → [tor][proxy][necko-active]
| Comment hidden (mozreview-request) |
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review85876
::: netwerk/socket/nsSOCKSIOLayer.cpp:520
(Diff revision 1)
> PRErrorCode c = PR_GetError();
> // If EINPROGRESS, return now and check back later after polling
> if (c == PR_WOULD_BLOCK_ERROR || c == PR_IN_PROGRESS_ERROR) {
> mState = SOCKS_CONNECTING_TO_PROXY;
> return status;
> + } else if (c == PR_FILE_NOT_FOUND_ERROR) {
This fix leaves other (less likely?) return codes without action. Wouldn't it be even better to make that an "else" to catch all other errors and treat them the same way?
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review85878
Attachment #8802454 -
Flags: review?(daniel) → review+
| Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Daniel Stenberg [:bagder] from comment #3)
> Comment on attachment 8802454 [details]
> Bug 1311044 - show error when domain socket is not found;
>
> https://reviewboard.mozilla.org/r/86856/#review85876
>
> ::: netwerk/socket/nsSOCKSIOLayer.cpp:520
> (Diff revision 1)
> > PRErrorCode c = PR_GetError();
> > // If EINPROGRESS, return now and check back later after polling
> > if (c == PR_WOULD_BLOCK_ERROR || c == PR_IN_PROGRESS_ERROR) {
> > mState = SOCKS_CONNECTING_TO_PROXY;
> > return status;
> > + } else if (c == PR_FILE_NOT_FOUND_ERROR) {
>
> This fix leaves other (less likely?) return codes without action. Wouldn't
> it be even better to make that an "else" to catch all other errors and treat
> them the same way?
I think it just ignores errors and tries next addresses?
See https://dxr.mozilla.org/mozilla-central/rev/01ab78dd98805e150b0311cce2351d5b408f3001/netwerk/socket/nsSOCKSIOLayer.cpp#493
Ah yes, thanks. So other error codes should really continue and try again. Case closed then. Ship it! =)
| Reporter | ||
Comment 7•9 years ago
|
||
(In reply to Daniel Stenberg [:bagder] from comment #6)
> Ah yes, thanks. So other error codes should really continue and try again.
GetNextAddr() is not called in the case of a domain socket. I don't think we want to keep trying again for all other errors; that is what led to this bug.
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 9•9 years ago
|
||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
Hi Daniel,
I've just revised the condition checking.
Please see if this makes it better?
Attachment #8802454 -
Flags: review+ → feedback?(daniel)
| Assignee | ||
Updated•9 years ago
|
Attachment #8802454 -
Flags: feedback?(daniel) → review?(daniel)
Comment 10•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review86160
::: netwerk/socket/nsSOCKSIOLayer.cpp:517
(Diff revision 2)
> NetAddrToPRNetAddr(&proxy, &prProxy);
> status = fd->lower->methods->connect(fd->lower, &prProxy, mTimeout);
> if (status != PR_SUCCESS) {
> PRErrorCode c = PR_GetError();
> +
> + if (IsHostDomainSocket()) {
This implies that the connect() when using a domain socket can never return a WOULD_BLOCK or IN_PROGRESS error, but I assume that's how it works?
Attachment #8802454 -
Flags: review?(daniel) → review+
Comment 11•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review86162
| Assignee | ||
Comment 12•9 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review86160
> This implies that the connect() when using a domain socket can never return a WOULD_BLOCK or IN_PROGRESS error, but I assume that's how it works?
Yes, I think so.
| Assignee | ||
Comment 13•9 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review86160
> Yes, I think so.
I've changed my mind, I'll keep those checks.
| Comment hidden (mozreview-request) |
Comment 15•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8802454 [details]
Bug 1311044 - show error when connection to domain socket is failed;
https://reviewboard.mozilla.org/r/86856/#review86180
Comment 16•9 years ago
|
||
That seems safer, I agree.
Comment 17•9 years ago
|
||
Pushed by gachen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/df49275ec24c
show error when connection to domain socket is failed; r=bagder
Comment 18•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in
before you can comment on or make changes to this bug.
Description
•