From 211b734b85bc6f587dd768bd1528d07a15030ec2 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 33ccfe224..bd9048bf5 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -762,6 +762,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