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.10.3~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d841d6db43e1614d4851a5eb520bf0a4c2f45631;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) {