haproxy/src
Willy Tarreau d66ed88a78 MEDIUM: stream: re-arrange the connection setup status reporting
Till now when a wakeup happens after a connection is attempted, we go
through sess_update_st_con_tcp() to deal with the various possible events,
then to sess_update_st_cer() to deal with a possible error detected by the
former, or to sess_establish() to complete the connection validation. There
are multiple issues in the way this is handled, which have accumulated over
time. One of them is that any spurious wakeup during SI_ST_CON would validate
the READ_ATTACHED flag and wake the analysers up. Another one is that nobody
feels responsible for clearing SI_FL_EXP if it happened at the same time as
a success (and it is present in all reports of loops to date). And another
issue is that aborts cannot happen after a clean connection setup with no
data transfer (since CF_WRITE_NULL is part of CF_WRITE_ACTIVITY). Last, the
flags cleanup work was hackish, added here and there to please the next
function (typically what had to be donne in commit 7a3367cca to work around
the url_param+reuse issue by moving READ_ATTACHED to CON).

This patch performs a significant lift up of this setup code. First, it
makes sure that the state handlers are the ones responsible for the cleanup
of the stuff they rely on. Typically sess_sestablish() will clean up the
SI_FL_EXP flag because if we decided to validate the connection it means
that we want to ignore this late timeout. Second, it splits the CON and
RDY state handlers because the former only has to deal with failures,
timeouts and non-events, while the latter has to deal with partial or
total successes. Third, everything related to connection success was
moved to sess_establish() since it's the only safe place to do so, and
this function is also called at a few places to deal with synchronous
connections, which are not seen by intermediary state handlers.

The code was made a bit more robust, for example by making sure we
always set SI_FL_NOLINGER when aborting a connection so that we don't
have any risk to leave a connection in SHUTW state in case it was
validated late. The useless return codes of some of these functions
were dropped so that callers only rely on the stream-int's state now
(which was already partially the case anyway).

The code is now a bit cleaner, could be further improved (and functions
renamed) but given the sensitivity of this part, better limit changes to
strictly necessary. It passes all reg tests.
2019-06-06 16:36:19 +02:00
..
51d.c BUG/MINOR: 51d: Get the request channel to call CHECK_HTTP_MESSAGE_FIRST() 2019-04-19 15:53:23 +02:00
acl.c BUG/MINOR: acl: properly detect pattern type SMP_T_ADDR 2019-04-19 11:45:20 +02:00
action.c MINOR: stick-tables: Add peers process binding computing. 2019-05-07 06:54:07 +02:00
activity.c MINOR: activity: enable automatic profiling turn on/off 2019-04-25 17:26:46 +02:00
applet.c MEDIUM: appctx/debug: force a crash if an appctx spins over itself forever 2019-04-26 13:15:56 +02:00
arg.c MINOR: sample: Rework gRPC converter code. 2019-03-05 11:04:23 +01:00
auth.c CLEANUP: build: rename some build macros to use the USE_* ones 2019-05-22 19:47:57 +02:00
backend.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
base64.c BUG/MINOR: base64: dec func ignores padding for output size checking 2019-01-14 19:32:15 +01:00
buffer.c MEDIUM: memory: use pool_destroy_all() to destroy all pools on deinit() 2018-11-26 19:50:32 +01:00
cache.c MEDIUM: htx: Add the parsing of trailers of chunked messages 2019-06-05 10:12:11 +02:00
cfgparse-global.c MAJOR: polling: add event ports support (Solaris) 2019-05-21 15:16:45 +02:00
cfgparse-listen.c MEDIUM: config: deprecate the antique req* and rsp* commands 2019-05-22 20:43:45 +02:00
cfgparse.c MINOR: server: really increase the pool-purge-delay default to 5 seconds 2019-06-06 16:25:55 +02:00
channel.c MINOR: channel: Add the function channel_add_input 2019-01-02 20:12:44 +01:00
checks.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
chunk.c BUG/MEDIUM: init/threads: provide per-thread alloc/free function callbacks 2019-05-22 14:59:08 +02:00
cli.c MINOR: activity: report the number of failed pool/buffer allocations 2019-05-28 17:25:21 +02:00
compression.c MINOR: time: move the cpu, mono, and idle time to thread_info 2019-05-20 21:14:14 +02:00
connection.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
da.c MEDIUM: http/htx: Perform analysis relatively to the first block 2019-05-28 07:42:12 +02:00
debug.c MEDIUM: tasks: Get rid of active_tasks_mask. 2019-05-29 21:53:37 +02:00
dict.c MINOR: dict: Add dictionary new data structure. 2019-06-05 08:33:35 +02:00
dns.c MINOR: action: new '(http-request|tcp-request content) do-resolve' action 2019-04-23 11:41:52 +02:00
ev_epoll.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_evports.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_kqueue.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_poll.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_select.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
fd.c BUG/MEDIUM: threads: fix double-word CAS on non-optimized 32-bit platforms 2019-05-27 17:40:59 +02:00
filters.c MEDIUM: filters/htx: Filter body relatively to the first block 2019-05-28 07:42:33 +02:00
flt_http_comp.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
flt_spoe.c MEDIUM: stream-int: introduce a new state SI_ST_RDY 2019-06-06 16:36:19 +02:00
flt_trace.c BUG/MINOR: flt_trace/htx: Only apply the random forwarding on the message body. 2019-06-05 10:12:11 +02:00
freq_ctr.c BUG/MAJOR: threads/freq_ctr: use a memory barrier to detect changes 2017-10-31 18:01:18 +01:00
frontend.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
h1.c MEDIUM: h1: Add an option to sanitize connection headers during parsing 2019-04-12 22:06:53 +02:00
h2.c MEDIUM: htx: Add the parsing of trailers of chunked messages 2019-06-05 10:12:11 +02:00
haproxy.c BUG/MINOR: deinit/threads: make hard-stop-after perform a clean exit 2019-06-02 11:30:07 +02:00
hash.c MINOR: hash: add new function hash_crc32c 2018-03-21 05:04:01 +01:00
hathreads.c MINOR: threads: implement ha_tkill() and ha_tkillall() 2019-05-22 11:50:48 +02:00
hdr_idx.c CLEANUP: pools: rename all pool functions and pointers to remove this "2" 2017-11-24 17:49:53 +01:00
hlua.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
hlua_fcn.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
hpack-dec.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-enc.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-huff.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-tbl.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
http.c BUILD: do not specify "const" on functions returning structs or scalars 2019-04-15 21:55:48 +02:00
http_acl.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
http_act.c BUG/MEDIUM: http: fix "http-request reject" when not final 2019-05-28 08:26:17 +02:00
http_conv.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
http_fetch.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
http_htx.c MINOR: htx: make htx_add_data() return the transmitted byte count 2019-05-28 14:48:59 +02:00
http_msg.c BUG/MEDIUM: http: Use pointer to the begining of input to parse message headers 2019-05-10 11:47:00 +02:00
http_rules.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
htx.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02: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 MINOR: backend: move hash_balance_factor out of chash 2019-01-14 19:33:17 +01:00
lb_fas.c BUG/MEDIUM: lb/threads: always properly lock LB algorithms on maintenance operations 2018-08-21 19:44:53 +02:00
lb_fwlc.c MINOR: lb: make the leastconn algorithm more accurate 2018-12-14 08:33:28 +01:00
lb_fwrr.c BUG/MAJOR: lb/threads: make sure the avoided server is not full on second pass 2019-05-27 10:29:59 +02:00
lb_map.c MEDIUM: lb/threads: Use the new _HA_ATOMIC_* macros. 2019-03-11 17:02:38 +01:00
listener.c BUG/MEDIUM: listener: Fix how unlimited number of consecutive accepts is handled 2019-04-30 15:28:29 +02:00
log.c BUG/MEDIUM: init/threads: provide per-thread alloc/free function callbacks 2019-05-22 14:59:08 +02: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/MEDIUM: maps: only try to parse the default value when it's present 2019-04-19 11:35:22 +02:00
memory.c MINOR: activity: report the number of failed pool/buffer allocations 2019-05-28 17:25:21 +02:00
mux_h1.c BUG/MINOR: mux-h1: Don't send more data than expected 2019-06-05 10:12:11 +02:00
mux_h2.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
mux_pt.c CLEANUP: build: rename some build macros to use the USE_* ones 2019-05-22 19:47:57 +02:00
mworker-prog.c BUG/MINOR: mworker: Fix memory leak of mworker_proc members 2019-05-22 11:29:18 +02:00
mworker.c BUG/MINOR: mworker: Fix memory leak of mworker_proc members 2019-05-22 11:29:18 +02:00
namespace.c MINOR: initcall: apply initcall to all register_build_opts() calls 2018-11-26 19:50:32 +01:00
pattern.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
payload.c MINOR: htx: Remove the macro IS_HTX_SMP() and always use IS_HTX_STRM() instead 2019-05-28 07:42:12 +02:00
peers.c BUG/MINOR: peers: Wrong server name parsing. 2019-06-06 16:06:00 +02:00
pipe.c BUILD: address a few cases of "static <type> inline foo()" 2019-04-15 21:55:48 +02:00
proto_http.c MEDIUM: sessions: Introduce session flags. 2019-05-29 15:41:47 +02:00
proto_htx.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
proto_sockpair.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
proto_tcp.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02: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 MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
protocol.c MEDIUM: protocol: use a custom AF_MAX to help protocol parser 2018-09-12 07:12:27 +02:00
proxy.c BUG/MINOR: deinit/threads: make hard-stop-after perform a clean exit 2019-06-02 11:30:07 +02:00
queue.c BUG/MEDIUM: queue: fix the tree walk in pendconn_redistribute. 2019-05-27 10:29:59 +02:00
raw_sock.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
regex.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
sample.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
server.c MINOR: server: really increase the pool-purge-delay default to 5 seconds 2019-06-06 16:25:55 +02:00
session.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
sha1.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
shctx.c CLEANUP: Fix typos in the shctx subsystem 2018-12-02 18:40:29 +01:00
signal.c CLEANUP: Fix a typo in the signal subsystem 2018-12-02 18:39:52 +01:00
ssl_sock.c BUG/MEDIUM: ssl: Don't forget to initialize ctx->send_recv and ctx->recv_wait. 2019-06-06 13:21:23 +02:00
standard.c BUILD: tools: do not use the weak attribute for trace() on obsolete linkers 2019-06-04 16:02:26 +02:00
stats.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
stick_table.c MINOR: stick-table: Make the CLI stick-table handler support dictionary entry data type. 2019-06-05 08:42:36 +02:00
stream.c MEDIUM: stream: re-arrange the connection setup status reporting 2019-06-06 16:36:19 +02:00
stream_interface.c MAJOR: stream-int: switch from SI_ST_CON to SI_ST_RDY on I/O 2019-06-06 16:36:19 +02:00
task.c BUILD: task: fix a build warning when threads are disabled 2019-06-04 17:18:40 +02:00
tcp_rules.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
time.c MINOR: time: move the cpu, mono, and idle time to thread_info 2019-05-20 21:14:14 +02:00
trace.c CONTRIB: trace: try to display the function's return value on exit 2017-10-24 19:54:25 +02:00
uri_auth.c CLEANUP: log: Rename Alert/Warning in ha_alert/ha_warning 2017-11-24 17:19:12 +01:00
vars.c BUG/MEDIUM: vars: make the tcp/http unset-var() action support conditions 2019-06-04 16:48:15 +02:00
version.c BUILD: add a new file "version.c" to carry version updates 2019-01-04 18:20:32 +01:00
wdt.c BUILD: watchdog: condition it to USE_RT 2019-05-23 10:20:55 +02:00
wurfl.c MINOR: WURFL: do not emit warnings when not configured 2019-05-22 14:01:22 +02:00
xprt_handshake.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
xxhash.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00