[erlang-questions] can "gen_tcp:recv" blocks my entire server?

Joe Armstrong <>
Thu Apr 22 12:48:23 CEST 2010

On Thu, Apr 22, 2010 at 1:12 AM, zabrane Mikael <> wrote:
> Hi List,
> I'm impleting a simple Web server using gen_tcp:listen(Port, [...,{active,
> false}]) options.
> For each request, a child process is spawned to handle it.
> Then, each child process use gen_tcp:recv/2 to read data from the client
> socket.
> Very basic design!
> My question is simple. If one of my child processes calls gen_tcp:recv/2 and
> blocks (due to a slow client),
> does this also blocks all other spawned childs?


You'd better post the code - perhaps your spawns don't do what you
think they do, or some
process has died, or something. The code should not block so if it
does something else is wrong.
Difficult to say without peering at the code.

> If yes, what's the best way to read from a socket without blocking the
> entire server (i.e the other spawned processes)?
> Regards
> Zabrane

More information about the erlang-questions mailing list