]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: protocols: add a global lock for the init/deinit stuff
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Jul 2019 14:45:02 +0000 (16:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Jul 2019 14:45:02 +0000 (16:45 +0200)
commitdaacf3664506d56a1f3b050ccba504886a18b12a
tree502da101d4c5de25dc37233bbcbdafb6bc37d04c
parentf0f42389772b2303b162e929449a36b33e181c5f
BUG/MEDIUM: protocols: add a global lock for the init/deinit stuff

Dragan Dosen found that the listeners lock is not sufficient to protect
the listeners list when proxies are stopping because the listeners are
also unlinked from the protocol list, and under certain situations like
bombing with soft-stop signals or shutting down many frontends in parallel
from multiple CLI connections, it could be possible to provoke multiple
instances of delete_listener() to be called in parallel for different
listeners, thus corrupting the protocol lists.

Such operations are pretty rare, they are performed once per proxy upon
startup and once per proxy on shut down. Thus there is no point trying
to optimize anything and we can use a global lock to protect the protocol
lists during these manipulations.

This fix (or a variant) will have to be backported as far as 1.8.
include/proto/protocol.h
include/types/protocol.h
src/listener.c
src/proto_sockpair.c
src/proto_tcp.c
src/proto_uxst.c
src/protocol.c