Fix: consumer data lock deadlock caused by monitor timer
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 8 May 2017 19:06:25 +0000 (15:06 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 8 May 2017 19:06:25 +0000 (15:06 -0400)
commit873dda4e25e5199d434d322fb7d64697cd9868d3
tree3776d07834b5ebcbd945807f70cadb62ce1f293b
parent0b0ac4a97d325a6938992f5c04987d5d48167a21
Fix: consumer data lock deadlock caused by monitor timer

The execution of the monitor timer takes the consumer data lock
which causes three threads to deadlock.

The consumer_thread_data_poll_thread takes the lock during
the teardown of a channel. This teardown stops the channel's
timers and, to ensure that the timers are not fired on a free'd
channel, uses a custom SIG_TEARDOWN signal as a "bubble" inserted
the signal processing "queue". It then waits until this signal
has been processed to release the consumer data lock.

The sessiond_poll_thread is creating a channel and waits on
the consumer data lock.

Meanwhile, the timer thread is blocked on this same lock
during the processing of the monitor timer signal which
prevents the queue from being flushed, causing the destruction
of the channel to never reach completion.

There is no need to take the consumer data lock in the monitor
timer code since the channel's existence is guaranteed by
the SIG_TEARDOWN mechanism.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer/consumer-timer.c
This page took 0.025517 seconds and 4 git commands to generate.