Open Bug 1481963 Opened 3 years ago Updated 3 years ago

TCPSocket gets stuck frequently on MacOSX

Categories

(Core :: DOM: Networking, enhancement, P3)

Unspecified
macOS
enhancement

Tracking

()

Tracking Status
firefox63 --- affected

People

(Reporter: hiro, Unassigned)

Details

(Whiteboard: [necko-triaged])

We are using TCPSocket to communicate with adb server for the purpose of remote debugging for Firefox Android or other remote Firefox instances.

In bug 1469054, I wrote some xpcshell tests for the remote debugging.  Unfortunately all sort of the test cases fail intermittently on MacOSX.

:jdescottes wrote a minimum test case in bug 1469054 comment 91, it looks like this;

  // Assumes that port 5037 is not used at this moment.
  const socket = new TCPSocket("127.0.0.1", 5037, { binaryType: "arraybuffer" });
  await waitUntil(() => socket.readyState === "closed");

As far as I can tell all the test cases work fine on Linux, so it seems that there is a bug in network stack on MacOSX.

I just pushed a try with the minimum test case;
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4077ddb963f46241e1c8707703c68c7bd4fdd197
Odd, the test on the try didn't fail at all.
From https://hg.mozilla.org/mozilla-central/file/cea8cf3f6abe/dom/network/tests/test_tcpsocket_client_and_server_basics.js#l4

 // Bug 788960 and later bug 1329245 have taught us that attempting to connect to
 // a port that is not listening or is no longer listening fails to consistently
 // result in the error (or any) event we expect on Darwin/OSX/"OS X".

This bug is exactly the problem in this comment. We should keep this bug open until the issue has been completely fixed.
(In reply to Hiroyuki Ikezoe (:hiro) (PTO on Aug 20) from comment #2)
> From
> https://hg.mozilla.org/mozilla-central/file/cea8cf3f6abe/dom/network/tests/
> test_tcpsocket_client_and_server_basics.js#l4
> 
>  // Bug 788960 and later bug 1329245 have taught us that attempting to
> connect to
>  // a port that is not listening or is no longer listening fails to
> consistently
>  // result in the error (or any) event we expect on Darwin/OSX/"OS X".
> 
> This bug is exactly the problem in this comment. We should keep this bug
> open until the issue has been completely fixed.

Fun question: Is this bug happening when the client side of the socket is OSX, or when connecting to an OSX server?
Or does it apply to localhost only?
Did anyone file a bug against OSX?
Flags: needinfo?(hikezoe)
Priority: -- → P3
Whiteboard: [necko-triaged]
I should have filed with specifying MacOSX only.

(In reply to Valentin Gosu [:valentin] from comment #3)
> (In reply to Hiroyuki Ikezoe (:hiro) (PTO on Aug 20) from comment #2)
> > From
> > https://hg.mozilla.org/mozilla-central/file/cea8cf3f6abe/dom/network/tests/
> > test_tcpsocket_client_and_server_basics.js#l4
> > 
> >  // Bug 788960 and later bug 1329245 have taught us that attempting to
> > connect to
> >  // a port that is not listening or is no longer listening fails to
> > consistently
> >  // result in the error (or any) event we expect on Darwin/OSX/"OS X".
> > 
> > This bug is exactly the problem in this comment. We should keep this bug
> > open until the issue has been completely fixed.
> 
> Fun question: Is this bug happening when the client side of the socket is
> OSX, or when connecting to an OSX server?
> Or does it apply to localhost only?

I actually don't have any MacOS machines, so I can't answer the question exactly.
What I know of is that the client is on MacOSX, and I guess the server side doesn't matter at all, since nobody listens the port in question (5037).

Julian, would you mind trying to change the ip address to another one other than localhost?
Flags: needinfo?(hikezoe) → needinfo?(jdescottes)
OS: Unspecified → Mac OS X
I tried with the IP of my router and I have the same intermittent behavior, so it really seems to be a client issue.
Flags: needinfo?(jdescottes)
You need to log in before you can comment on or make changes to this bug.