From: Jérémie Galarneau Date: Wed, 14 Feb 2018 19:59:35 +0000 (-0500) Subject: Assert that the consumer socket lock is taken during communication X-Git-Tag: v2.11.0-rc1~403 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=211b734b85bc6f587dd768bd1528d07a15030ec2;p=lttng-tools.git Assert that the consumer socket lock is taken during communication 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 --- 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) {