]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http/threads: atomically increment the error snapshot ID
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Sep 2018 09:29:59 +0000 (11:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Sep 2018 09:31:58 +0000 (11:31 +0200)
Let's use an atomic increment for the error snapshot, as we'd rather
not assign the same ID to two errors happening in parallel. It's very
unlikely that it will ever happen though.

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

index 8ccbc2bcd51a57a8a235341232b7bfeeae372699..cf759fbdd595dbe76af044034df7e4c176b53e7a 100644 (file)
@@ -8053,7 +8053,7 @@ void http_capture_bad_message(struct proxy *proxy, struct error_snapshot *es, st
                memset(&es->src, 0, sizeof(es->src));
 
        es->state = state;
-       es->ev_id = error_snapshot_id++;
+       es->ev_id = HA_ATOMIC_XADD(&error_snapshot_id, 1);
        es->b_flags = chn->flags;
        es->s_flags = s->flags;
        es->t_flags = s->txn->flags;