tcp_close during async accept

Steve Davis <>
Thu Jul 9 00:17:38 CEST 2009


Joel et al.

I'm not sure if this is related but I'm seeing the same thing about
30-50$ of the time on a client socket connection when using...

  ok = inet:setopts(Socket, [{packet, http_bin}, {keepalive, true}]),
  case gen_tcp:recv(Socket, 0, Timeout) of
  ...

...possible bug in R13B01, or perhaps a bug in my usage of the socket?

/sd


On Jul 6, 11:20 am, Joel Reymont <> wrote:
> 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?
>


More information about the erlang-questions mailing list