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

zabrane Mikael <>
Thu Apr 22 10:11:42 CEST 2010


2010/4/22 Paul Fisher <>

> Have you tried it?
>

Yes of course I have.
This is why I'm asking if recv/2 is the problem in my server design?



>
> --
> paul
>
> On Apr 21, 2010, at 6:16 PM, "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?
> >
> > 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