<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hello,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Alexey managed to find the steps to reproduced the problem.</DIV><DIV>You can have a process managing a TCP connection linked to a dead socket under the following conditions.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>0. Use active once to receive your TCP message to benefit from TCP regulation</DIV><DIV><SPAN class="Apple-style-span"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">1. Assume we </SPAN></FONT><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">have a socket in {Active, false} state</SPAN></FONT></SPAN></DIV><DIV><SPAN class="Apple-style-span"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">2. Close its connection from the other end</SPAN></FONT></SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">3. </SPAN></FONT><SPAN class="Apple-style-span" style="font-size: 12px;">call gen_tcp:send on the socket two times (It returns ok on the first send, which is also wrong. The problem happens only with two or more sends).</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">4. swith to {active, once} state</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">=> no {tcp_closed, ...} message is received by the process.</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">If you check the state of your port after step 4 (for example with inet:peername) you will receive an error enotconn.</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">You end up with a stuck process. If you send messages to the process queue to send messages on the socket it will accumulate indefinitely.</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Please, let me know if we can do something more to help.</DIV><DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Mickaël Rémond</DIV><DIV> <A href="http://www.process-one.net">http://www.process-one.net</A>/</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></DIV><BR></DIV></BODY></HTML>