haproxy/include/common
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
..
accept4.h
base64.h
buffer.h DOC: buffers: clarify the purpose of the <from> pointer in offer_buffers() 2018-03-08 18:33:48 +01:00
cfgparse.h MINOR: config: Enable tracking of up to MAX_SESS_STKCTR stick counters. 2018-01-29 13:53:56 +01:00
chunk.h CLEANUP: pools: rename all pool functions and pointers to remove this "2" 2017-11-24 17:49:53 +01:00
compat.h BUILD: tcp: define SOL_TCP when only IPPROTO_TCP exists 2016-08-10 21:11:38 +02:00
compiler.h MINOR: compiler: introduce offsetoff(). 2018-02-05 14:24:50 +01:00
config.h BUG/MINOR: pools/threads: don't ignore DEBUG_UAF on double-word CAS capable archs 2018-02-22 14:18:45 +01:00
debug.h
defaults.h MINOR: log: Add logurilen tunable. 2017-06-02 11:06:36 +02:00
epoll.h
errors.h
h2.h MINOR: h2: add a function to report pseudo-header names 2017-12-30 17:17:07 +01:00
hash.h
hathreads.h BUG/MAJOR: threads/queue: Fix thread-safety issues on the queues management 2018-03-19 10:03:06 +01:00
hpack-dec.h MEDIUM: h2: change hpack_decode_headers() to only provide a list of headers 2017-11-21 21:13:36 +01:00
hpack-enc.h MEDIUM: hpack: implement basic hpack encoding 2017-10-31 18:03:24 +01:00
hpack-huff.h MINOR: hpack: implement the HPACK Huffman table decoder 2017-10-31 18:03:24 +01:00
hpack-tbl.h BUG/MAJOR: hpack: don't pretend large headers fit in empty table 2017-12-04 18:06:51 +01:00
http-hdr.h MINOR: http: add very simple header management based on double strings 2017-10-22 09:54:14 +02:00
ist.h MINOR: ist: add ist0() to add a trailing zero to a string. 2017-10-19 15:01:08 +02:00
memory.h MINOR: debug/pools: make DEBUG_UAF also detect underflows 2018-02-22 14:18:45 +01:00
mini-clist.h MEDIUM: lists: list_for_each_entry{_safe}_from functions 2017-10-31 03:44:11 +01:00
namespace.h
net_helper.h MINOR: net_helper: add 64-bit read/write functions 2017-09-21 06:27:08 +02:00
regex.h MINOR: threads/regex: Change Regex trash buffer into a thread local variable 2017-10-31 13:58:31 +01:00
splice.h
standard.h CLEANUP: standard: Fix typo in IPv6 mask example 2018-02-21 05:07:35 +01:00
syscall.h BUILD: enable build on Linux/s390x 2015-10-12 20:58:51 +02:00
template.h
ticks.h
time.h MEDIUM: threads/time: Many global variables from time.h are now thread-local 2017-10-31 13:58:30 +01:00
tools.h
uri_auth.h MINOR: stats: add ST_SHOWADMIN to pass the admin info in the regular flags 2016-03-11 17:08:05 +01:00
version.h [RELEASE] Released version 1.9-dev0 2017-11-26 19:50:17 +01:00
xref.h MEDIUM: threads/xref: Convert xref function to a thread safe model 2017-10-31 13:58:32 +01:00