Undocumented {packet,http} and gen_tcp:recv/3 timeout
Sean Hinde
sean.hinde@REDACTED
Tue Nov 1 21:59:53 CET 2005
Hi!
Yes, indeed. I will fix the tutorial.
Sean
On 1 Nov 2005, at 20:01, Eric Merritt wrote:
> Just for future reference, Pete pointed out the race condition in
> iserve_socket:init. It's an easy fix and pretty noticeable once you
> think about it.
>
> ---------- Forwarded message ----------
> From: Pete Kazmier <pete-expires-20051230@REDACTED>
> Date: Oct 31, 2005 1:20 PM
> Subject: Re: Undocumented {packet,http} and gen_tcp:recv/3 timeout
> To: Eric Merritt <cyberlync@REDACTED>
>
>
> Hi there,
>
> I recently went through that same tutorial and found the bug that the
> author hinted at in his recent post to the mailing list. In the event
> that you have not already found it, there is a race condition within
> iserve_socket:init in between the gen_tcp:accept and inet:setsockopts
> call. Its possible that part of the HTTP request arrives before the
> socket is placed it {packet, http} mode, and since the socket is in
> active mode, a message would be delivered to the current process which
> does nothing with it. In this case, inet:setsockopts needs to be
> called on the listening socket so the accepted socket will be in
> {packet, http} right from the start.
>
> As an erlang newbie, I still have not been able to get his example to
> run yet as I can't figure out appropriate directory layout for the
> application. If you have this working, would you mind sending me a
> tarball of the directory? It would be very helpful!
>
> Thanks,
> Pete
>
More information about the erlang-questions
mailing list