[erlang-bugs] Missing the tcp_closed event

Mickaël Rémond <>
Fri Apr 13 18:23:45 CEST 2007


Alexey managed to find the steps to reproduced the problem.
You can have a process managing a TCP connection linked to a dead  
socket under the following conditions.

0. Use active once to receive your TCP message to benefit from TCP  
1. Assume we have a socket in {Active, false} state
2. Close its connection from the other end
3. 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).
4. swith to {active, once} state
=> no {tcp_closed, ...} message is received by the process.

If you check the state of your port after step 4 (for example with  
inet:peername) you will receive an error enotconn.

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.

Please, let me know if we can do something more to help.

Mickaël Rémond

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20070413/8a974c2a/attachment.html>

More information about the erlang-bugs mailing list