<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello Francis,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My test scenario just hit the condition. The connection however got broken with the following error message:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Failed to get next 2 bytes to read header from the wire, failed to received content, shutting down id=2 the connection, errno=0 (No error)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Since the number of bytes read was not printed, I am guessing it was 1.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The receive call did not actually fail but possibly delivered 1 byte.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Rahul<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Kale, Rahul
<br>
<b>Sent:</b> Friday, April 22, 2016 10:04 AM<br>
<b>To:</b> 'francis.brosnan@aspl.es'<br>
<b>Cc:</b> nopoll@lists.aspl.es<br>
<b>Subject:</b> RE: Fixed -- Re: [noPoll] Websocket disconnect issues<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I am currently running the test scenario but the failure condition has not happened yet<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">in the first 12 hours. Sometimes it takes 2-3 days to reproduce. I will let you<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">know when it happens next.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Besides the SSL twist, even for plain TCP connection I believe this situation can occur.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Due to maximum transmission unit (MTU) limitations the sender can break up messages<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">at arbitrary byte boundaries. If the receiver is slow to read, or if the network<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">bandwidth is limited, a fast sender will accumulate data to send. It will send<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">piled up data (multiple websocket messages in our case) in chunks of MTU size<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">and end up breaking messages at arbitrary byte boundaries.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You are totally correct in saying that the OS will not deliver bytes collected<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">from the wire to user space in a broken fashion. But the OS on the sender can put the<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">bytes on the wire in arbitrary pieces (TCP segments) depending on transient network conditions,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">acks received, TCP sliding window size, round trip time, MTU size etc.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I am no expert at this, but the few TCP protocols I have implemented I have always had to account for this<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">before the application achieved 24/7 reliability.  For non-blocking sockets this is not trivial to achieve.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For blocking sockets, it is much easier.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I am glad that you are considering fixing this properly. It will make the nopoll<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">library more robust for everyone :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Rahul<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Francis Brosnan Blázquez [<a href="mailto:francis.brosnan@aspl.es">mailto:francis.brosnan@aspl.es</a>]
<br>
<b>Sent:</b> Friday, April 22, 2016 5:52 AM<br>
<b>To:</b> Kale, Rahul<br>
<b>Cc:</b> <a href="mailto:nopoll@lists.aspl.es">nopoll@lists.aspl.es</a><br>
<b>Subject:</b> Re: Fixed -- Re: [noPoll] Websocket disconnect issues<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Raul,<br>
<br>
It is going to take us a bit to deeply resolve the issue and<br>
more precisely, to support websockets peers sending byte<br>
by byte important parts of the headers that should be received<br>
at once...<br>
<br>
In any case, I was wondering if you did have time to check<br>
latest modifications... did them resolve the issue? Is it more<br>
stable your test case?<br>
<br>
Please, let us know how the latest changes performs in your<br>
scenario,<br>
<br>
Best Regards,<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">Hello,<br>
<br>
Thanks very much for your excellent analysis. It is indeed surprising that such a small packet seems to be delivered in chunks occasionally. Perhaps the fact that this is via SSL is compounding the issue. The original websocket provided on the server side is
 proxied via Apache Webserver which adds an SSL layer.<br>
<br>
I see that the noPoll code is already handling broken headers for the first two bytes and also for 4 bytes of mask. I was assuming that you have already faced similar issues in the past.<br>
<br>
I really appreciate your efforts in chasing these issues and fixing them promptly.<br>
<br>
Regards,<br>
<br>
Rahul<br>
<br>
<br>
<br>
<br>
This message is subject to the following terms and conditions: MAIL DISCLAIMER<<a href="http://www.barco.com/en/maildisclaimer">http://www.barco.com/en/maildisclaimer</a>><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="padding:0in 0in 0in 0in">
<pre><o:p> </o:p></pre>
<pre>-- <o:p></o:p></pre>
<pre>Francis Brosnan Blázquez - ASPL<o:p></o:p></pre>
<pre>91 134 14 22 - 91 134 14 45 - 91 116 07 57<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><a href="http://aspl.es">http://aspl.es</a><o:p></o:p></pre>
<pre><a href="http://asplhosting.com">http://asplhosting.com</a><o:p></o:p></pre>
<pre><a href="http://twitter.com/aspl_es">http://twitter.com/aspl_es</a><o:p></o:p></pre>
<pre><a href="http://twitter.com/asplhosting">http://twitter.com/asplhosting</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>AVISO LEGAL<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Este mensaje se dirige exclusivamente a su destinatario. Los datos<o:p></o:p></pre>
<pre>incluidos en el presente correo son confidenciales y sometidos a secreto<o:p></o:p></pre>
<pre>profesional, se prohíbe divulgarlos, en virtud de las leyes vigentes. Si<o:p></o:p></pre>
<pre>usted no lo es y lo ha recibido por error o tiene conocimiento del mismo<o:p></o:p></pre>
<pre>por cualquier motivo, le rogamos que nos lo comunique por este medio y<o:p></o:p></pre>
<pre>proceda a destruirlo o borrarlo.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de<o:p></o:p></pre>
<pre>diciembre, de Protección de Datos de Carácter Personal, le informamos de<o:p></o:p></pre>
<pre>que sus datos de carácter personal, recogidos de fuentes accesibles al<o:p></o:p></pre>
<pre>público o datos que usted nos ha facilitado previamente, proceden de<o:p></o:p></pre>
<pre>bases de datos propiedad de Advanced Software Production Line, S.L.<o:p></o:p></pre>
<pre>(ASPL). No obstante, usted puede ejercitar sus derechos de acceso,<o:p></o:p></pre>
<pre>rectificación, cancelación y oposición dispuestos en la mencionada Ley<o:p></o:p></pre>
<pre>Orgánica, notificándolo por escrito a:<o:p></o:p></pre>
<pre>ASPL - Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de<o:p></o:p></pre>
<pre>Henares (Madrid).<o:p></o:p></pre>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
This message is subject to the following terms and conditions: <a href="http://www.barco.com/en/maildisclaimer">
MAIL DISCLAIMER</a>
</body>
</html>