haproxy/include/proto
Willy Tarreau 9df86f997e BUG/MAJOR: lb/threads: fix insufficient locking on round-robin LB
Maksim Kupriianov reported very strange crashes in fwrr_update_position()
which didn't make sense because of an apparent divide overflow except that
the value was not null in the core.

It happens that while the locking is correct in all the functions' call
graph, the uppermost one (fwrr_get_next_server()) incorrectly expected
that its target server was already locked when called. This stupid
assumption causd the server lock not to be held when calling the other
ones, explaining how it was possible to change the server's eweight by
calling srv_lb_commit_status() under the server lock yet collide with
its unprotected usage.

This commit makes sure that fwrr_get_server_from_group() retrieves a
locked server and that fwrr_get_next_server() is responsible for
unlocking the server before returning it. There is one subtlety in
this function which is that it builds a list of avoided servers that
were full while scanning the tree, and all of them are queued in a
full state so they must be unlocked upon return.

Many thanks to Maksim for providing detailed info allowing to narrow
down this bug.

This fix must be backported to 1.9. In 1.8 the lock seems much wider
and changes to the server's state are performed under the rendez-vous
point so this it doesn't seem possible that it happens there.
2019-04-16 11:21:14 +02:00
..
acl.h MINOR: acl: Pass the ACLs as an explicit parameter of build_acl_cond 2017-10-31 11:36:12 +01:00
action.h MAJOR: chunks: replace struct chunk with struct buffer 2018-07-19 16:23:43 +02:00
activity.h MINOR: activity: add configuration and CLI support for "profiling.tasks" 2018-11-22 11:48:51 +01:00
applet.h MEDIUM: applets: Use the new _HA_ATOMIC_* macros. 2019-03-11 17:02:37 +01:00
arg.h MINOR: sample: Moves ARGS underlying type from 32 to 64 bits. 2016-03-15 22:11:52 +01:00
auth.h MEDIUM: pattern: The match function browse itself the list or the tree. 2014-03-17 18:06:07 +01:00
backend.h BUG/MAJOR: lb/threads: fix insufficient locking on round-robin LB 2019-04-16 11:21:14 +02:00
channel.h BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
checks.h BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
cli.h MINOR: cli: export cli_parse_default() definition in cli.h 2019-04-01 14:45:37 +02:00
compression.h REORG: filters: Prepare creation of the HTTP compression filter 2016-02-09 14:53:15 +01:00
connection.h MEDIUM: connection: Add conn_upgrade_mux_fe() to handle mux upgrades 2019-04-12 22:06:53 +02:00
dns.h BUG/MINOR: dns: Don't try to get the server lock if it's already held. 2017-11-06 18:34:24 +01:00
fd.h MEDIUM: fd: Use the new _HA_ATOMIC_* macros. 2019-03-11 17:02:37 +01:00
filters.h MINOR: filters: Export the name of known filters 2018-12-11 17:09:31 +01:00
flt_http_comp.h MINOR: compression: Rename the function check_legacy_http_comp_flt() 2018-12-11 17:09:31 +01:00
freq_ctr.h MEDIUM: freq_ctr: Use the new _HA_ATOMIC_* macros. 2019-03-11 17:02:37 +01:00
frontend.h REORG/MAJOR: session: rename the "session" entity to "stream" 2015-04-06 11:23:56 +02:00
hdr_idx.h CLEANUP: pools: rename all pool functions and pointers to remove this "2" 2017-11-24 17:49:53 +01:00
hlua_fcn.h MINOR: lua: add utility function for check boolean argument 2016-11-24 21:35:10 +01:00
hlua.h BUILD/MINOR: lua: ensure that hlua_ctx_destroy is properly defined 2015-06-17 20:18:54 +02:00
http_fetch.h MINOR: http_fetch: Add smp_prefetch_htx 2018-11-18 22:09:00 +01:00
http_htx.h CLEANUP: h1: remove some occurrences of unneeded h1.h inclusions 2018-12-11 17:15:13 +01:00
http_rules.h REORG: http: move HTTP rules parsing to http_rules.c 2018-10-02 18:28:05 +02:00
lb_chash.h MINOR: lb: allow redispatch when using consistent hash 2019-01-02 20:22:17 +01:00
lb_fas.h
lb_fwlc.h
lb_fwrr.h
lb_map.h MEDIUM: threads/lb: Make LB algorithms (lb_*.c) thread-safe 2017-10-31 13:58:31 +01:00
listener.h MINOR: listener: introduce listener_backlog() to report the backlog value 2019-02-28 17:05:29 +01:00
log.h MEDIUM: initcall: use initcalls for a few initialization functions 2018-11-26 19:50:32 +01:00
map.h MINOR: samples: rename some struct member from "smp" to "data" 2015-08-20 17:13:46 +02:00
mux_pt.h MEDIUM: connection: start to introduce a mux layer between xprt and data 2017-10-31 18:03:23 +01:00
mworker.h MEDIUM: mworker-prog: implement program for master-worker 2019-04-01 14:45:37 +02:00
obj_type.h MINOR: objtype: report a few missing types in names and base pointers 2018-12-18 16:31:10 +01:00
openssl-compat.h MINOR: ssl: generate-certificates for BoringSSL 2018-10-08 09:42:34 +02:00
pattern.h BUG/MEDIUM: map/acl: fix unwanted flags inheritance. 2017-07-04 10:45:53 +02:00
payload.h REORG/MAJOR: session: rename the "session" entity to "stream" 2015-04-06 11:23:56 +02:00
peers.h BUG/MEDIUM: peers: Missing peer initializations. 2019-02-12 19:49:22 +01:00
pipe.h
port_range.h
proto_http.h MINOR: http: update the macro IS_HTX_STRM() to check the stream flag SF_HTX 2019-04-12 22:06:53 +02:00
proto_sockpair.h MEDIUM: protocol: sockpair protocol 2018-09-12 07:20:17 +02:00
proto_tcp.h MINOR: connection: make conn_sock_drain() work for all socket families 2018-08-24 14:45:46 +02:00
proto_udp.h CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept() 2016-04-14 11:18:22 +02:00
protocol_buffers.h BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
protocol.h CLEANUP: Fix a typo in the protocol header file 2018-12-02 18:42:49 +01:00
proxy.h BUILD: address a few cases of "static <type> inline foo()" 2019-04-15 21:55:48 +02:00
queue.h MEDIUM: init: use initcall for all fixed size pool creations 2018-11-26 19:50:32 +01:00
raw_sock.h CLEANUP: connection: unexport raw_sock and ssl_sock 2016-12-22 23:26:38 +01:00
sample.h CLEANUP: Fix typos in the sample subsystem 2018-11-18 22:26:42 +01:00
server.h BUILD: address a few cases of "static <type> inline foo()" 2019-04-15 21:55:48 +02:00
session.h MINOR: muxes: Pass the context of the mux to destroy() instead of the connection 2019-04-12 22:06:53 +02:00
shctx.h BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
signal.h MEDIUM: initcall: use initcalls for a few initialization functions 2018-11-26 19:50:32 +01:00
spoe.h CLEANUP: Fix typos in the spoe subsystem 2018-11-18 22:26:42 +01:00
ssl_sock.h MINOR: ssl: add support of aes256 bits ticket keys on file and cli. 2019-01-14 19:32:58 +01:00
stats.h MINOR: stats: Move stuff about the stats status codes in stats files 2019-03-15 14:34:59 +01:00
stick_table.h MINOR: stktable: provide an unchecked version of stktable_data_ptr() 2018-09-20 11:42:15 +02:00
stream_interface.h MINOR: stream-int: add a new flag to mention that we want the connection to be killed 2019-01-31 19:38:25 +01:00
stream.h BUILD: address a few cases of "static <type> inline foo()" 2019-04-15 21:55:48 +02:00
task.h CLEANUP: task: do not export rq_next anymore 2019-04-15 09:50:56 +02:00
tcp_rules.h MINOR: action: Use trk_idx instead of tcp/http_trk_idx 2017-10-31 11:36:12 +01:00
template.h
vars.h MINOR: vars: Add 'unset-var' action/converter 2016-11-09 22:57:01 +01:00