[noPoll] Websocket disconnect issues

Kale, Rahul Rahul.Kale en barco.com
Mie Abr 20 03:32:46 CEST 2016


I have been trying to track down a random websocket disconnection issue that we are facing.
In our application, after some random number of hours of a good websocket connection that is
transferring data back and forth, the connection suddenly breaks. We are using noPoll only
for the client side of a WebSocket connection. The server side is Apache frontend with
node app backend.

After eliminating all other probable causes, I enabled noPoll debug logs and was finally able
to catch the error which causes a disconnect:

nopoll_conn.c:2797 Failed to get next 2 bytes to read header from the wire, failed to received content, shutting down id=2 the connection

Reproducing this is difficult since it takes anything from a couple of hours to a couple of days
but eventually it happens. My debugging efforts at narrowing this down is thus taking quite a while.

We are using secure web sockets (wss://).

Looking at the code, it seems that in the noPoll library, we expect the next two bytes of
the websocket header to be always available if we read the first two bytes.
I think that over TCP (and possibly even more so over TLS)
this may not always be guaranteed. The socket is non-blocking and it may occasionally
have a pattern that 4 bytes are split over two (or more) TCP segments.

For reading first two bytes noPoll library seems to be buffering if data is not available.
For correctness, should not this be done for subsequent parts of the header too?
Of course, I am not an expert here so could you analyze and let me know what is could
be the root cause? What should be my next steps?

I have already verified that this is not due to http(s) server error. I did a TCP dump
and confirmed that when this happens, the first FIN is sent by the client (noPoll) to the http server.



Rahul Kale

IP Video Systems
Barco, Inc
1287 Anvilwood Ave
Sunnyvale, CA  94089

Tel  +1 408 400 4238

This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20160420/974bfcdc/attachment.html>

Más información sobre la lista de distribución noPoll