diff options
author | Willy Tarreau <w@1wt.eu> | 2021-11-22 17:46:13 +0100 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2021-11-22 17:46:13 +0100 |
commit | c5e7cf9e696cbc7fbe3f01a6109bd6588a6feabd (patch) | |
tree | 20b875eb2c563573c4340b3bdfabfe8096eb0141 | |
parent | 0a1e1cb55549833700a79a8ffb0e85bbbd110f90 (diff) | |
download | haproxy-c5e7cf9e696cbc7fbe3f01a6109bd6588a6feabd.tar.gz |
BUG/MINOR: ssl: make SSL counters atomic
SSL counters were added with commit d0447a7c3 ("MINOR: ssl: add counters
for ssl sessions") in 2.4, but their updates were not atomic, so it's
likely that under significant loads they are not correct.
This needs to be backported to 2.4.
-rw-r--r-- | src/ssl_sock.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 2df48e034..e3e3abf62 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -5844,13 +5844,13 @@ reneg_ok: } if (counters) { - ++counters->sess; - ++counters_px->sess; + HA_ATOMIC_INC(&counters->sess); + HA_ATOMIC_INC(&counters_px->sess); } } else if (counters) { - ++counters->reused_sess; - ++counters_px->reused_sess; + HA_ATOMIC_INC(&counters->reused_sess); + HA_ATOMIC_INC(&counters_px->reused_sess); } /* The connection is now established at both layers, it's time to leave */ @@ -5876,8 +5876,8 @@ reneg_ok: } if (counters) { - ++counters->failed_handshake; - ++counters_px->failed_handshake; + HA_ATOMIC_INC(&counters->failed_handshake); + HA_ATOMIC_INC(&counters_px->failed_handshake); } /* Fail on all other handshake errors */ |