From: Willy Tarreau Date: Mon, 31 Oct 2016 16:32:20 +0000 (+0100) Subject: BUG/MEDIUM: peers: on shutdown, wake up the appctx, not the stream X-Git-Tag: v1.7-dev6~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78c0c50705a5e9d48607b9377adf030bb9d97b34;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: peers: on shutdown, wake up the appctx, not the stream This part was missed when peers were ported to the new applet infrastructure in 1.6, the main stream is woken up instead of the appctx. This creates a race condition by which it is possible to wake the stream at the wrong moment and miss an event. This bug might be at least partially responsible for some of the CLOSE_WAIT that were reported on peers session upon reload in version 1.6. This fix must be backported to 1.6. --- diff --git a/src/peers.c b/src/peers.c index d11792f918..03a0c9f200 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1735,11 +1735,9 @@ static void peer_session_forceshutdown(struct stream * stream) if (ps) ps->reconnect = tick_add(now_ms, MS_TO_TICKS(50 + random() % 2000)); - /* call release to reinit resync states if needed */ - peer_session_release(appctx); appctx->st0 = PEER_SESS_ST_END; appctx->ctx.peers.ptr = NULL; - task_wakeup(stream->task, TASK_WOKEN_MSG); + appctx_wakeup(appctx); } /* Pre-configures a peers frontend to accept incoming connections */