haproxy/src
Willy Tarreau 3c0cc49d30 BUG/MEDIUM: connection: ensure to always report the end of handshakes
Despite the previous commit working fine on all tests, it's still not
sufficient to completely address the problem. If the connection handler
is called with an event validating an L4 connection but some handshakes
remain (eg: accept-proxy), it will still wake the function up, which
will not report the activity, and will not detect a change once the
handshake it complete so it will not notify the ->wake() handler.

In fact the only reason why the ->wake() handler is still called here
is because after dropping the last handshake, we try to call ->recv()
and ->send() in turn and change the flags in order to detect a data
activity. But if for any reason the data layer is not interested in
reading nor writing, it will not get these events.

A cleaner way to address this is to call the ->wake() handler only
on definitive status changes (shut, error), on real data activity,
and on a complete connection setup, measured as CONNECTED with no
more handshake pending.

It could be argued that the handshake flags have to be made part of
the condition to set CO_FL_CONNECTED but that would currently break
a part of the health checks. Also a handshake could appear at any
moment even after a connection is established so we'd lose the
ability to detect a second end of handshake.

For now the situation around CO_FL_CONNECTED is not clean :
  - session_accept() only sets CO_FL_CONNECTED if there's no pending
    handshake ;

  - conn_fd_handler() will set it once L4 and L6 are complete, which
    will do what session_accept() above refrained from doing even if
    an accept_proxy handshake is still pending ;

  - ssl_sock_infocbk() and ssl_sock_handshake() consider that a
    handshake performed with CO_FL_CONNECTED set is a renegociation ;
    => they should instead filter on CO_FL_WAIT_L6_CONN

  - all ssl_fc_* sample fetch functions wait for CO_FL_CONNECTED before
    accepting to fetch information
    => they should also get rid of any pending handshake

  - smp_fetch_fc_rcvd_proxy() uses !CO_FL_CONNECTED instead of
    CO_FL_ACCEPT_PROXY

  - health checks (standard and tcp-checks) don't check for HANDSHAKE
    and may report a successful check based on CO_FL_CONNECTED while
    not yet done (eg: send buffer full on send_proxy).

This patch aims at solving some of these side effects in a backportable
way before this is reworked in depth :
  - we need to call ->wake() to report connection success, measure
    connection time, notify that the data layer is ready and update
    the data layer after activity ; this has to be done either if
    we switch from pending {L4,L6}_CONN to nothing with no handshakes
    left, or if we notice some handshakes were pending and are now
    done.

  - we document that CO_FL_CONNECTED exactly means "L4 connection
    setup confirmed at least once, L6 connection setup confirmed
    at least once or not necessary, all this regardless of any
    possibly remaining handshakes or future L6 negociations".

This patch also renames CO_FL_CONN_STATUS to the more explicit
CO_FL_NOTIFY_DATA, and works around the previous flags trick consiting
in setting an impossible combination of flags to notify the data layer,
by simply clearing the current flags.

This fix should be backported to 1.7, 1.6 and 1.5.
2017-03-19 12:06:18 +01:00
..
51d.c CLEANUP: 51d: move global settings out of the global section 2016-12-21 21:30:54 +01:00
acl.c CLEANUP: sample: report "converter" instead of "conv method" in error messages 2016-11-25 07:36:22 +01:00
applet.c BUG/MAJOR: Fix how the list of entities waiting for a buffer is handled 2016-12-12 19:11:04 +01:00
arg.c MINOR: sample: Moves ARGS underlying type from 32 to 64 bits. 2016-03-15 22:11:52 +01:00
auth.c CLEANUP: auth: use the build options list to report its support 2016-12-21 21:30:54 +01:00
backend.c CLEANUP: Replace repeated code to count usable servers with be_usable_srv() 2017-03-13 18:26:05 +01:00
base64.c [MINOR] add encode/decode function for 30-bit integers from/to base64 2010-10-30 19:04:33 +02:00
buffer.c BUG/MAJOR: Fix how the list of entities waiting for a buffer is handled 2016-12-12 19:11:04 +01:00
cfgparse.c CLEANUP: config: Typo in comment. 2017-03-15 16:01:51 +01:00
channel.c BUG/MEDIUM: channel: bad unlikely macro 2016-11-14 15:23:17 +01:00
checks.c BUG/MINOR: checks: attempt clean shutw for SSL check 2017-03-15 11:41:25 +01:00
chunk.c MINOR: chunks: implement a simple dynamic allocator for trash buffers 2017-02-08 11:16:29 +01:00
cli.c CLEANUP: connection: remove all direct references to raw_sock and ssl_sock 2016-12-22 23:26:38 +01:00
compression.c MINOR: compression: fix -vv output without zlib/slz 2017-01-11 16:11:11 +01:00
connection.c BUG/MEDIUM: connection: ensure to always report the end of handshakes 2017-03-19 12:06:18 +01:00
da.c CLEANUP: da: move global settings out of the global section 2016-12-21 21:30:54 +01:00
dns.c MINOR: dns: give ability to dns_init_resolvers() to close a socket when requested 2017-02-03 07:21:32 +01:00
ev_epoll.c CLEANUP: poll: move the conditions for waiting out of the poll functions 2015-04-13 20:47:51 +02:00
ev_kqueue.c CLEANUP: remove unneeded casts 2016-04-03 14:17:42 +02:00
ev_poll.c BUILD: poll: remove unused hap_fd_isset() which causes a warning with clang 2016-08-10 21:23:48 +02:00
ev_select.c CLEANUP: poll: move the conditions for waiting out of the poll functions 2015-04-13 20:47:51 +02:00
fd.c CLEANUP: remove unneeded casts 2016-04-03 14:17:42 +02:00
filters.c BUG/MEDIUM: filters: Fix channels synchronization in flt_end_analyze 2017-03-15 19:09:06 +01:00
flt_http_comp.c OPTIM: http: move all http character classs tables into a single one 2016-11-05 15:58:08 +01:00
flt_spoe.c MINOR: spoe: Add "max-frame-size" statement in spoe-agent section 2017-03-09 15:32:56 +01:00
flt_trace.c MINOR: filters: Add check_timeouts callback to handle timers expiration on streams 2016-11-21 15:29:58 +01:00
freq_ctr.c BUG/MINOR: time: frequency counters are not totally accurate 2012-12-29 21:50:07 +01:00
frontend.c MINOR: proxy: Add fe_name/be_name fetchers next to existing fe_id/be_id 2016-12-12 15:10:43 +01:00
haproxy-systemd-wrapper.c BUG/MEDIUM: systemd-wrapper: return correct exit codes 2016-11-03 20:34:20 +01:00
haproxy.c MINOR: chunks: implement a simple dynamic allocator for trash buffers 2017-02-08 11:16:29 +01:00
hash.c MINOR: hash: add new function hash_crc32 2015-01-20 19:48:05 +01:00
hdr_idx.c OPTIM/MINOR: move the hdr_idx pools out of the proxy struct 2011-10-24 18:15:04 +02:00
hlua_fcn.c BUILD: lua: build failed on FreeBSD. 2016-12-23 18:03:43 +01:00
hlua.c BUG/MAJOR: lua segmentation fault when the request is like 'GET ?arg=val HTTP/1.1' 2017-02-23 21:52:18 +01:00
i386-linux-vsys.c MEDIUM: listener: add support for linux's accept4() syscall 2012-10-08 20:11:03 +02:00
lb_chash.c MEDIUM: server: Implement bounded-load hash algorithm 2016-10-25 20:21:32 +02:00
lb_fas.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_fwlc.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_fwrr.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_map.c CLEANUP: remove unneeded casts 2016-04-03 14:17:42 +02:00
listener.c BUG/MEDIUM: listener: do not try to rebind another process' socket 2017-03-15 12:47:46 +01:00
log.c CLEANUP: connection: remove all direct references to raw_sock and ssl_sock 2016-12-22 23:26:38 +01:00
lru.c MINOR: lru: new function to delete <nb> least recently used keys 2016-01-11 07:31:35 +01:00
mailers.c MEDIUM: Add parsing of mailers section 2015-02-03 00:24:16 +01:00
map.c BUG/MINOR: Fix "get map <map> <value>" CLI command 2017-03-13 18:25:53 +01:00
memory.c CLEANUP: memory: remove the now unused cli_parse_show_pools() function 2016-12-16 19:40:13 +01:00
namespace.c CLEANUP: namespaces: use the build options list to report it 2016-12-21 21:30:54 +01:00
pattern.c BUG/MINOR: pattern: Avoid memory leak on out-of-memory condition 2016-03-13 07:47:25 +01:00
payload.c CLEANUP: ssl: Remove goto after return dead code 2016-11-14 18:15:20 +01:00
peers.c MEDIUM: move listener->frontend to bind_conf->frontend 2016-12-22 23:26:38 +01:00
pipe.c BUILD/MINOR: silent a build warning in src/pipe.c (fcntl) 2011-10-24 17:09:22 +02:00
proto_http.c BUG/MEDIUM: filters: Fix channels synchronization in flt_end_analyze 2017-03-15 19:09:06 +01:00
proto_tcp.c BUG/MEDIUM: tcp: don't poll for write when connect() succeeds 2017-01-25 18:46:01 +01:00
proto_udp.c CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept() 2016-04-14 11:18:22 +02:00
proto_uxst.c BUG/MINOR: unix: fix connect's polling in case no data are scheduled 2017-01-25 18:48:14 +01:00
protocol.c BUILD: protocol: fix some build errors on OpenBSD 2016-08-10 19:31:58 +02:00
proxy.c MINOR: cli: Let configure the dynamic cookies from the cli. 2017-03-15 11:38:29 +01:00
queue.c MINOR: proxy: add 'served' field to proxy, equal to total of all servers' 2016-10-25 20:21:32 +02:00
raw_sock.c CLEANUP: connection: unexport raw_sock and ssl_sock 2016-12-22 23:26:38 +01:00
rbtree.c
regex.c MEDIUM: regex: pcre2 support 2016-12-28 12:51:51 +01:00
sample.c CLEANUP: Remove comment that's no longer valid 2017-03-13 18:26:05 +01:00
server.c BUG/MEDIUM server: Fix crash when dynamic is defined, but not key is provided. 2017-03-15 16:01:33 +01:00
session.c CLEANUP: connection: remove all direct references to raw_sock and ssl_sock 2016-12-22 23:26:38 +01:00
shctx.c MEDIUM: ssl: Add support for OpenSSL 1.1.0 2016-11-08 20:54:41 +01:00
signal.c MEDIUM: unblock signals on startup. 2016-04-20 10:53:12 +02:00
ssl_sock.c BUG/MEDIUM: ssl: Clear OpenSSL error stack after trying to parse OCSP file 2017-03-10 18:53:22 +01:00
standard.c BUG/MEDIUM: tools: do not force an unresolved address to AF_INET:0.0.0.0 2017-01-11 12:44:33 +01:00
stats.c MEDIUM: stats: Add show json schema 2017-03-14 11:14:03 +01:00
stick_table.c BUG/MINOR: sample-fetches/stick-tables: bad type for the sample fetches sc*_get_gpt0 2017-01-05 16:04:05 +01:00
stream_interface.c BUG/MAJOR: stream-int: do not depend on connection flags to detect connection 2017-03-19 12:00:04 +01:00
stream.c BUG/MAJOR: channel: Fix the definition order of channel analyzers 2017-01-05 17:58:22 +01:00
task.c MINOR: task: Rename run_queue and run_queue_cur counters 2016-12-12 19:10:54 +01:00
tcp_rules.c MINOR: tcp-rules: check that the listener exists before updating its counters 2016-12-22 23:26:37 +01:00
time.c BUG/MINOR: time: frequency counters are not totally accurate 2012-12-29 21:50:07 +01:00
trace.c BUG/MEDIUM: trace.c: rdtsc() is defined in two files 2016-04-09 22:27:01 +02:00
uri_auth.c CLEANUP: uniformize last argument of malloc/calloc 2016-04-03 14:17:42 +02:00
vars.c BUG/MEDIUM: variables: some variable name can hide another ones 2016-12-12 14:34:56 +01:00
wurfl.c CLEANUP: wurfl: move global settings out of the global section 2016-12-21 21:30:54 +01:00
xxhash.c CLEANUP: remove unneeded casts 2016-04-03 14:17:42 +02:00