]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stream: use atomic increments for the request counter
authorWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2018 14:21:29 +0000 (16:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2018 14:30:19 +0000 (16:30 +0200)
commit90a7c03ec0bc405fd9514a0a65dccc15b8c4a993
tree5da8972ae18474fb8fa1761e3d45b250627dda94
parent9378df89f65b2fa8b6effb6dfbe7a4de70b53702
BUG/MINOR: stream: use atomic increments for the request counter

The request counter is incremented when creating a new stream and when
resetting a stream, preparing for a new request. Unfortunately during
the thread migration this was missed, leading to non-atomic increments
in case threads are in use. The most visible side effect is that two
requests may have the same ID from time to time in the logs. However
the SPOE also uses this ID to route responses back to the stream so it
may also lead to occasional spurious SPOE timeouts.

Note that it still doesn't guarantee temporal unicity in the stream
identifiers since a long and a short connection could technically use
the same ID. The likeliness that this happens at the same time is almost
null (roughly threads*runqueue_depth/2^32 that it happens in the same
poll loop), but it will have to be addressed later anyway.

This patch must be backported to 1.8 with the other one it relies on
("MINOR: thread: implement HA_ATOMIC_XADD()").
src/proto_http.c
src/stream.c