Hi Cyril,

On Sun, Sep 07, 2014 at 06:30:40PM +0200, Cyril Bonté wrote:
> Hi all,
> 
> Le 06/09/2014 08:28, Willy Tarreau a écrit :
> >To be honnest, I think it is necessary, and I hope it will be enough. We
> >had this issue in 1.5-dev as well a long time ago and the problem was the
> >same, the beginning of the message was not moved. Now 1.5's buffer 
> >semantics
> >have changed to make all this much simpler. There is one thing to test to
> >confirm it's enough : make a farm with two untested servers, one which does
> >not respond and a valid one so that there's a retry and redispatch. Haproxy
> >will first pick server1, prepend the header, and try to send the request
> >there. After the failure it will redispatch to server2 and rewind the
> >buffer to change the header. On server2 you should see a valid request if
> >the fix is OK. That's how I managed to fix it in 1.5-dev. The config below
> >should be enough to reproduce it :
> >
> >    listen test :10002
> >      balance roundrobin
> >      mode http
> >      option http-server-close
> >      http-send-name-header Host
> >      retries 1
> >      option redispatch
> >      server bad  127.0.0.1:12345
> >      server good 127.0.0.1:80
> >
> >I also remember that rewinding POST requests is harder than rewinding
> >GET because the body was already partially parsed. I remember something
> >in 1.4 which we did to take care of that, either we refrain from parsing
> >the body before connecting when there's the send-name-header, or we could
> >correctly rewind. So sending a POST request through the config above will
> >tell you if that's OK :-)
> 
> I was optimistic during my tests unless I tried sending POST requests 
> with a body longer than the buffer size. In certain conditions, haproxy 
> segfaults. For example, this is the case with the "bad" server, no need 
> to redispatch.
> 
> I need some time to remember how buffers work in 1.4, in order to fix 
> the segfault.

Argh, crap! I fear that we're opening a new can of worms :-(

At least we have working code in 1.5 so we know there's a fix, but the two
versions are so much different that we cannot port 1.5 changes back to 1.4.
It's possible however that we'll have to add a WAIT_CONN flag to prevent
the body from being parsed/forwarded until the connection is opened.

Willy


Reply via email to