[AWS] Google Chrome + AWS WebSockets + refresh = sockets stuck in CLOSE_WAIT forever

Thomas Løcke thomas.granvej6 at gmail.com
Wed Jul 25 16:15:51 CEST 2012


When testing the AWS WebSocket demo, I see some odd behavior when using
Google Chrome.

Try firing up the demo and then use Google Chrome (I'm at version 20.0.1132.47)
to go to localhost:8080. Now refresh the page a few times, and then do a
"lsof -i | grep localhost:8080":

chrome    19903 thomas  107u  IPv4 685128      0t0  TCP
localhost:55500->localhost:8080 (ESTABLISHED)
chrome    19903 thomas  112u  IPv4 682606      0t0  TCP
localhost:55501->localhost:8080 (ESTABLISHED)
websock   20790 thomas   12u  IPv4 673683      0t0  TCP
localhost:8080->localhost:55430 (CLOSE_WAIT)
websock   20790 thomas   13u  IPv4 680396      0t0  TCP
localhost:8080->localhost:55436 (CLOSE_WAIT)
websock   20790 thomas   14u  IPv4 682432      0t0  TCP
localhost:8080->localhost:55443 (CLOSE_WAIT)
websock   20790 thomas   15u  IPv4 682447      0t0  TCP
localhost:8080->localhost:55449 (CLOSE_WAIT)
websock   20790 thomas   16u  IPv4 680494      0t0  TCP
localhost:8080->localhost:55456 (CLOSE_WAIT)
websock   20790 thomas   17u  IPv4 673759      0t0  TCP
localhost:8080->localhost:55462 (CLOSE_WAIT)
websock   20790 thomas   18u  IPv4 680496      0t0  TCP
localhost:8080->localhost:55474 (CLOSE_WAIT)
websock   20790 thomas   19u  IPv4 673767      0t0  TCP
localhost:8080->localhost:55469 (CLOSE_WAIT)
websock   20790 thomas   20u  IPv4 685103      0t0  TCP
localhost:8080->localhost:55481 (CLOSE_WAIT)
websock   20790 thomas   21u  IPv4 685114      0t0  TCP
localhost:8080->localhost:55488 (CLOSE_WAIT)
websock   20790 thomas   22u  IPv4 684189      0t0  TCP
localhost:8080->localhost:55494 (CLOSE_WAIT)
websock   20790 thomas   23u  IPv4 685129      0t0  TCP
localhost:8080->localhost:55500 (ESTABLISHED)
websock   20790 thomas   24u  IPv4 682607      0t0  TCP
localhost:8080->localhost:55501 (ESTABLISHED)

Odd stuff eh?

When you end the demo (by pressing Q), this is emitted:

Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down
Received : Connection_Close GOING_AWAY, AWS server going down

That's a whole bunch of connections closing, despite there only being one
open tab in Chrome.

Now doing the exact same thing using Firefox (one tab, refresh several
times), you'll get this output from lsof:

firefox    2488 thomas   42u  IPv4 686238      0t0  TCP
localhost:55644->localhost:8080 (ESTABLISHED)
firefox    2488 thomas   45u  IPv4 686247      0t0  TCP
localhost:55663->localhost:8080 (ESTABLISHED)
websock   20952 thomas    4u  IPv4 680890      0t0  TCP
localhost:8080->localhost:55644 (ESTABLISHED)
websock   20952 thomas    9u  IPv4 685019      0t0  TCP
localhost:8080->localhost:55663 (ESTABLISHED)

and this when you quit the demo:

Received : Connection_Close GOING_AWAY, AWS server going down

Of special interest is that everytime you refresh the page when using
Firefox the demo emits one of these messages:

Received : Connection_Close GOING_AWAY,

It's apparent that Firefox plays nice with the AWS WebSocket
implementation, and just as clear that Chrome is not playing nice. Who's to
blame is unknown to me, but as it stands using AWS WebSockets with Google
Chrome appears to be a rather dangerous project, as you will flood your
system with "dead" sockets.

Regards,
Thomas Løcke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/aws/attachments/20120725/2232cf4c/attachment.html>


More information about the AWS mailing list