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.
This commit is contained in:
Willy Tarreau 2016-10-31 17:32:20 +01:00
parent 7c2be1f34a
commit 78c0c50705

View File

@ -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 */