[erlang-questions] tcp_close during async accept

Trevor Woollacott [ MTN - Innovation Centre ] <>
Tue Jul 7 13:10:37 CEST 2009


What OS are you using? Maybe the maximum backlog on your platform is less than 1024?

Regards,
Trevor

> -----Original Message-----
> From:  [mailto:]
> On Behalf Of Joel Reymont
> Sent: Monday, 06 July 2009 06:21 PM
> To: Erlang Users' List
> Subject: [erlang-questions] tcp_close during async accept
>
> I'm playing with Serge's "Non-blocking TCP server using OTP
> principles" [1]. When spawning a large number of connections almost at
> once, I'm seeing tcp_close messages on the client end, even before
> seeing inet_async on the client end.
>
> I may spawn 700 client connections and only half may go through, even
> though my backlog option is 1024, e.g.
>
>      Opts = [binary,
>              {packet, 0},
>              {reuseaddr, true},
>              {keepalive, true},
>              {backlog, 1024},
>              {active, false}],
>      case gen_tcp:listen(Port, Opts) of
>          {ok, Socket} ->
>              %% Create first accepting process
>              {ok, Ref} = prim_inet:async_accept(Socket, -1),
> ...
>
> Any suggestions on what's going on?
>
> Is it kosher to use prim_inet:async_accept/2?
>
> Am I using backlog correctly?
>
>       Thanks, Joel
>
> [1] http://www.trapexit.org/Building_a_Non-
> blocking_TCP_server_using_OTP_principles
>
> ---
> Mac hacker with a performance bent
> http://www.linkedin.com/in/joelreymont
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org


NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/SUPPORT/LEGAL/Pages/EmailDisclaimer.aspx


More information about the erlang-questions mailing list