]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: thread/peers: fix deadlock on peers sync.
authorEmeric Brun <ebrun@haproxy.com>
Fri, 1 Dec 2017 10:37:36 +0000 (11:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Dec 2017 14:06:43 +0000 (15:06 +0100)
Table lock was not released on an error path (if there is no
enough room to write table switch message).

[wt: needs to be backported to 1.8]

src/peers.c

index 7580742f7df066240252c441e5fce33bdaeb0b26..155f3342a33c8833c6ff708130b7428247442c9b 100644 (file)
@@ -1474,6 +1474,7 @@ incomplete:
 
                                                                        msglen = peer_prepare_switchmsg(st, trash.str, trash.size);
                                                                        if (!msglen) {
+                                                                               HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
                                                                                /* internal error: message does not fit in trash */
                                                                                appctx->st0 = PEER_SESS_ST_END;
                                                                                goto switchstate;
@@ -1482,6 +1483,7 @@ incomplete:
                                                                        /* message to buffer */
                                                                        repl = ci_putblk(si_ic(si), trash.str, msglen);
                                                                        if (repl <= 0) {
+                                                                               HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
                                                                                /* no more write possible */
                                                                                if (repl == -1) {
                                                                                        goto full;