On Fri, Mar 12, 2010 at 10:55:21PM +0100, Willy Tarreau wrote:
> most likely because of a race condition : when there's a single one,
> as soon as the request is sent, it's received, processed and the response
> is sent. With two concurrent processes, it's possible that sometimes one
> of them has the time to send the request and the shutdown before the
> response is received and processed.
> 
> > read(0, "show info\n", 8192)            = 10
> > write(3, "show info\n", 10)             = 10
> > select(4, [0 3], [3], [], NULL)         = 2 (in [0], out [3])
> > read(0, "", 8192)                       = 0
> > shutdown(3, 1 /* send */)               = 0
> > select(4, [3], [], [], {0, 500000})     = 1 (in [3], left {0, 499998})
> > read(3, "", 8192)                       = 0

Interestingly my version behaves differently :

read(0, "show info\n"..., 8192)         = 10
write(3, "show info\n"..., 10)          = 10
select(16, [0 3], [3], [], NULL)        = 3 (in [0 3], out [3])
read(0, ""..., 8192)                    = 0
read(3, "Name: HAProxy\nVersion: 1.4.0-3\nRe"..., 8192) = 305
write(1, "Name: HAProxy\nVersion: 1.4.0-3\nRe"..., 305Name: HAProxy

=> it does not immediately send the shutdown() after read()=0.

That's the reason why I can't reproduce it. I'll update my socat
to get the same behaviour.

Regards,
Willy


Reply via email to