From 11b56a52390b3decde93e8efa5441b16b1842fae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 14 Feb 2018 14:59:35 -0500 Subject: [PATCH] Assert that the consumer socket lock is taken during communication MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The consumer_data lock must be acquired during any communication between the session and consumer daemons. Stress tests have shown a number of deadlocks that have been traced down to this type of errors. Individual fixes follow this commit. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 6ee397579..8290b5faf 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -763,6 +763,7 @@ int consumer_send_msg(struct consumer_socket *sock, assert(msg); assert(sock); + assert(pthread_mutex_trylock(sock->lock) == EBUSY); ret = consumer_socket_send(sock, msg, sizeof(struct lttcomm_consumer_msg)); if (ret < 0) { -- 2.34.1