BUG/MEDIUM: threads/unix: Fix a deadlock when a listener is temporarily disabled
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Mar 2018 09:04:47 +0000 (10:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Mar 2018 10:19:07 +0000 (11:19 +0100)
commit510c0d67ef8c44172b63be1a3d69be5f03ef14c3
tree052a67dd3c193f5f64c96826dec51f3a79303291
parent4288c5a9d81f89f65c02574a434b02e98eea943c
BUG/MEDIUM: threads/unix: Fix a deadlock when a listener is temporarily disabled

When a listener is temporarily disabled, we start by locking it and then we call
.pause callback of the underlying protocol (tcp/unix). For TCP listeners, this
is not a problem. But listeners bound on an unix socket are in fact closed
instead. So .pause callback relies on unbind_listener function to do its job.

Unfortunatly, unbind_listener hold the listener's lock and then call an internal
function to unbind it. So, there is a deadlock here. This happens during a
reload. To fix the problemn, the function do_unbind_listener, which is lockless,
is now exported and is called when a listener bound on an unix socket is
temporarily disabled.

This patch must be backported in 1.8.
include/proto/listener.h
src/listener.c
src/proto_uxst.c