]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: threads/freq_ctr: fix lock on freq counters.
authorEmeric Brun <ebrun@haproxy.com>
Mon, 30 Oct 2017 17:04:28 +0000 (18:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:33 +0000 (13:58 +0100)
commit6e0128630b80d691c915cba5cec43db59d191898
treef40838fff999c437d325a028ac584364827ee79b
parenta1ae7e81cd2553472a19dd3bce06590ea6ac06d0
BUG/MAJOR: threads/freq_ctr: fix lock on freq counters.

The wrong bit was set to keep the lock on freq counter update. And the read
functions were re-worked to use volatile.

Moreover, when a freq counter is updated, it is now rotated only if the current
counter is in the past (now.tv_sec > ctr->curr_sec). It is important with
threads because the current time (now) is thread-local. So, rounded to the
second, the time may vary by more or less 1 second. So a freq counter rotated by
one thread may be see 1 second in the future. In this case, it is updated but
not rotated.
include/proto/freq_ctr.h
src/freq_ctr.c