haproxy/include/types
Willy Tarreau 644c101e2d BUG/MAJOR: http: connection setup may stall on balance url_param
On the mailing list, seri0528@naver.com reported an issue when
using balance url_param or balance uri. The request would sometimes
stall forever.

Cyril Bonté managed to reproduce it with the configuration below :

  listen test :80
    mode http
    balance url_param q
    hash-type consistent
    server s demo.1wt.eu:80

and found it appeared with this commit : 80a92c0 ("BUG/MEDIUM: http:
don't start to forward request data before the connect").

The bug is subtle but real. The problem is that the HTTP request
forwarding analyzer refrains from starting to parse the request
body when some LB algorithms might need the body contents, in order
to preserve the data pointer and avoid moving things around during
analysis in case a redispatch is later needed. And in order to detect
that the connection establishes, it watches the response channel's
CF_READ_ATTACHED flag.

The problem is that a request analyzer is not subscribed to a response
channel, so it will only see changes when woken for other (generally
correlated) reasons, such as the fact that part of the request could
be sent. And since the CF_READ_ATTACHED flag is cleared once leaving
process_session(), it is important not to miss it. It simply happens
that sometimes the server starts to respond in a sequence that validates
the connection in the middle of process_session(), that it is detected
after the analysers, and that the newly assigned CF_READ_ATTACHED is
not used to detect that the request analysers need to be called again,
then the flag is lost.

The CF_WAKE_WRITE flag doesn't work either because it's cleared upon
entry into process_session(), ie if we spend more than one call not
connecting.

Thus we need a new flag to tell the connection initiator that we are
specifically interested in being notified about connection establishment.
This new flag is CF_WAKE_CONNECT. It is set by the requester, and is
cleared once the connection succeeds, where CF_WAKE_ONCE is set instead,
causing the request analysers to be scanned again.

For future versions, some better options will have to be considered :
  - let all analysers subscribe to both request and response events ;
  - let analysers subscribe to stream interface events (reduces number
    of useless calls)
  - change CF_WAKE_WRITE's semantics to persist across calls to
    process_session(), but that is different from validating a
    connection establishment (eg: no data sent, or no data to send)

The bug was introduced in 1.5-dev23, no backport is needed.
2014-04-30 20:02:02 +02:00
..
acl.h BUG/MEDIUM: patterns: last fix was still not enough 2014-04-28 14:19:17 +02:00
arg.h MEDIUM: http: The redirect strings follows the log format rules. 2013-12-02 23:31:33 +01:00
auth.h MAJOR: auth: Change the internal authentication system. 2014-03-17 18:06:06 +01:00
backend.h MEDIUM: backend: add support for the wt6 hash 2013-11-14 16:37:50 +01:00
capture.h [MAJOR] last bunch of capture changes for mempool v2 2007-05-13 22:46:04 +02:00
channel.h BUG/MAJOR: http: connection setup may stall on balance url_param 2014-04-30 20:02:02 +02:00
checks.h MEDIUM: tcp-check new feature: connect 2014-02-03 00:24:11 +01:00
compression.h MEDIUM: compression: use pool for comp_ctx 2012-11-21 01:56:47 +01:00
connection.h MEDIUM: ssl: implement a workaround for the OpenSSL heartbleed attack 2014-04-25 20:06:33 +02:00
counters.h MINOR: stats: Enhancement to stats page to provide information of last session time. 2014-02-08 01:19:58 +01:00
fd.h MAJOR: polling: rework the whole polling system 2014-01-26 00:42:30 +01:00
freq_ctr.h [MINOR] freq_ctr: add new types and functions for periods different from 1s 2010-08-10 14:01:09 +02:00
global.h MEDIUM: config: warn that '{cli,con,srv}timeout' are deprecated 2014-04-29 01:09:56 +02:00
hdr_idx.h [BUG] files were missing for hdr_idx in previous commit 2006-12-04 02:20:02 +01:00
lb_chash.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_fas.h MEDIUM: backend: add the 'first' balancing algorithm 2012-02-21 22:27:27 +01:00
lb_fwlc.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_fwrr.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_map.h [CLEANUP] proxy: move last lb-specific bits to their respective files 2009-10-03 18:41:18 +02:00
listener.h DIET/MINOR: listener: rearrange a few fields in struct listener to save 16 bytes 2013-12-09 16:06:21 +01:00
log.h BUG/MINOR: http: fix encoding of samples used in http headers 2014-03-17 16:39:03 +01:00
map.h MAJOR: pattern/map: Extends the map edition system in the patterns 2014-03-17 18:06:07 +01:00
obj_type.h DIET/MINOR: obj: pack the obj_type enum to 8 bits 2013-12-09 16:06:08 +01:00
pattern.h BUG/MEDIUM: patterns: last fix was still not enough 2014-04-28 14:19:17 +02:00
peers.h CLEANUP: Remove unused 'last_slowstart_change' field from struct peer 2013-11-19 08:04:59 +01:00
pipe.h [MEDIUM] introduce pipe pools 2009-01-25 13:49:53 +01:00
port_range.h [MEDIUM] add support for binding to source port ranges during connect 2009-06-10 12:23:32 +02:00
proto_http.h MEDIUM: http: make http-request rules processing return a verdict instead of a rule 2014-04-29 00:46:01 +02:00
proto_tcp.h MINOR: tcp: add new "close" action for tcp-response 2013-09-11 23:28:51 +02:00
protocol.h MEDIUM: protocol: implement a "drain" function in protocol layers 2013-06-10 20:33:23 +02:00
proxy.h CLEANUP: proxy: rename "block_cond" to "block_rules" 2014-04-28 22:05:31 +02:00
queue.h [MAJOR] ported pendconn to mempools v2 2007-05-13 20:19:55 +02:00
sample.h MINOR: configuration: File and line propagation 2014-03-17 18:06:08 +01:00
server.h MINOR: checks: use check->state instead of srv->state & SRV_CHECKED 2013-12-14 16:02:19 +01:00
session.h BUG/MEDIUM: http: continue to emit 503 on keep-alive to different server 2014-02-24 18:26:30 +01:00
signal.h [MEDIUM] signals: add support for registering functions and tasks 2010-08-27 18:00:40 +02:00
ssl_sock.h MEDIUM: ssl: improve crt-list format to support negation 2013-05-07 22:11:54 +02:00
stick_table.h MEDIUM: stick-tables: flush old entries upon soft-stop 2013-09-04 17:54:01 +02:00
stream_interface.h MEDIUM: dumpstats: Display error message during add of values. 2014-03-17 18:06:08 +01:00
task.h DIET/MINOR: task: reduce struct task size by 8 bytes 2013-12-09 16:06:22 +01:00
template.h [CLEANUP] included common/version.h everywhere 2006-06-29 18:54:54 +02:00