[erlang-questions] enotconn from gen_tcp socket

Sergei Fomin dafgar@REDACTED
Sat Jun 9 14:58:37 CEST 2012


Unfortunaly no, when I close connection correctly (i.e. fyn->, 
fyn_ack<-, ack->) and then do inet:peername, it still returns {ok, IP}. 
And yes, I have turned off exit_on_close socket option.

Attila Rajmund Nohl wrote:
> 2012/6/8 Sergei Fomin<dafgar@REDACTED>:
>> Hello.
>>
>> There is a server which gen_tcp:accept new connections and immediately logs
>> inet:peername. But still, "Accepted {error,enotconn}" can be seen in the log
>> files. One possible reason of such error is described in
>> http://erlang.org/pipermail/erlang-questions/2012-May/066802.html , i.e. a
>> client does 3-way handshake and sends RST packet immediately. Though, this
>> scenario seems uncommon.
>>
>> Wonder, what other causes can lead to enotconn on just opened socket?
>
> I think it doesn't have to be an RST, a normal connection closing
> would also lead to this error. I've seen a very similar error a couple
> of months ago when the OTP SFTP client did something similar as you,
> i.e. it had a
>
> {ok, PeerAddr} = inet:peername(Socket),
>
> call soon after the Socket was created and sometimes this crashed with
> a badmatch. The SFTP client has been fixed in R15B01, so there's a
> case and error handling instead of the matching.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Sergei Fomin
Yandex development team
http://staff.yandex-team.ru/dafgar




More information about the erlang-questions mailing list