]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stick_table: Prevent conn_cur from underflowing
authorTim Duesterhus <tim@bastelstu.be>
Thu, 3 Jan 2019 23:11:59 +0000 (00:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 15 Jan 2019 14:34:49 +0000 (15:34 +0100)
commit8b87c01c4d59247d9fb51a38cd12d5d94324b6a4
tree84dcc2ace4a338bfe31740009a8fd8d50a2b4468
parentf8f8ddf3afd3a73a6658394f5fd2a3cb46835a68
BUG/MINOR: stick_table: Prevent conn_cur from underflowing

When using the peers feature a race condition could prevent
a connection from being properly counted. When this connection
exits it is being "uncounted" nonetheless, leading to a possible
underflow (-1) of the conn_curr stick table entry in the following
scenario :

  - Connect to peer A     (A=1, B=0)
  - Peer A sends 1 to B   (A=1, B=1)
  - Kill connection to A  (A=0, B=1)
  - Connect to peer B     (A=0, B=2)
  - Peer A sends 0 to B   (A=0, B=0)
  - Peer B sends 0/2 to A (A=?, B=0)
  - Kill connection to B  (A=?, B=-1)
  - Peer B sends -1 to A  (A=-1, B=-1)

This fix may be backported to all supported branches.
include/proto/session.h
include/proto/stream.h