haproxy/include/types
Christopher Faulet 5cd4bbd7ab BUG/MAJOR: threads/queue: Fix thread-safety issues on the queues management
The management of the servers and the proxies queues was not thread-safe at
all. First, the accesses to <strm>->pend_pos were not protected. So it was
possible to release it on a thread (for instance because the stream is released)
and to use it in same time on another one (because we redispatch pending
connections for a server). Then, the accesses to stream's information (flags and
target) from anywhere is forbidden. To be safe, The stream's state must always
be updated in the context of process_stream.

So to fix these issues, the queue module has been refactored. A lock has been
added in the pendconn structure. And now, when we try to dequeue a pending
connection, we start by unlinking it from the server/proxy queue and we wake up
the stream. Then, it is the stream reponsibility to really dequeue it (or
release it). This way, we are sure that only the stream can create and release
its <pend_pos> field.

However, be careful. This new implementation should be thread-safe
(hopefully...). But it is not optimal and in some situations, it could be really
slower in multi-threaded mode than in single-threaded one. The problem is that,
when we try to dequeue pending connections, we process it from the older one to
the newer one independently to the thread's affinity. So we need to wait the
other threads' wakeup to really process them. If threads are blocked in the
poller, this will add a significant latency. This problem happens when maxconn
values are very low.

This patch must be backported in 1.8.
2018-03-19 10:03:06 +01:00
..
acl.h
action.h
applet.h
arg.h CLEANUP: Fix typo in ARGT_MSK6 comment 2018-01-25 22:25:40 +01:00
auth.h
backend.h MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
cache.h MEDIUM: cache: enable the HTTP analysers 2017-11-20 19:22:27 +01:00
capture.h CLEANUP: pools: rename all pool functions and pointers to remove this "2" 2017-11-24 17:49:53 +01:00
channel.h
checks.h BUILD: checks: don't include server.h 2017-11-29 10:54:05 +01:00
cli.h
compression.h
connection.h MINOR: early data: Don't rely on CO_FL_EARLY_DATA to wake up streams. 2018-02-05 14:24:50 +01:00
counters.h
dns.h MINOR: dns: Handle SRV record weight correctly. 2018-01-09 15:43:11 +01:00
fd.h MEDIUM: fd/threads: Make sure we don't miss a fd cache entry. 2018-02-05 16:02:22 +01:00
filters.h
freq_ctr.h
global.h MINOR: global: add some global activity counters to help debugging 2018-01-23 15:38:33 +01:00
h1.h
hdr_idx.h
hlua.h
lb_chash.h
lb_fas.h
lb_fwlc.h
lb_fwrr.h
lb_map.h
listener.h MINOR: config: Add threads support for "process" option on "bind" lines 2017-11-24 15:38:50 +01:00
log.h
mailers.h
map.h
obj_type.h
pattern.h MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
peers.h MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
pipe.h
port_range.h
proto_http.h MINOR: http: add a function to check request's cache-control header field 2017-12-22 17:56:17 +01:00
proto_udp.h
protocol.h
proxy.h CLEANUP: proxy: slightly reorder the struct proxy to reduce holes 2017-11-26 11:10:52 +01:00
queue.h BUG/MAJOR: threads/queue: Fix thread-safety issues on the queues management 2018-03-19 10:03:06 +01:00
sample.h
server.h MINOR: connection: add proxy-v2-options authority 2018-03-01 11:38:32 +01:00
session.h
shctx.h MEDIUM: shctx: use unsigned int for len and block_count 2017-11-21 21:35:04 +01:00
signal.h
spoe.h MEDIUM: spoe: Use an ebtree to manage idle applets 2018-02-02 16:00:32 +01:00
ssl_sock.h MINOR: ssl: extract full pkey info in load_certificate 2018-03-01 11:33:18 +01:00
stats.h MINOR: stats: display the number of threads in the statistics. 2018-02-26 11:53:46 +01:00
stick_table.h MINOR: stick-tables: Adds support for new "gpc1" and "gpc1_rate" counters. 2018-01-31 09:40:05 +01:00
stream_interface.h MINOR: stream-int: set flag SI_FL_CLEAN_ABRT when mux supports clean aborts 2017-12-20 16:56:32 +01:00
stream.h BUG/MAJOR: threads/queue: Fix thread-safety issues on the queues management 2018-03-19 10:03:06 +01:00
task.h MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
template.h
vars.h MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00