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.9.8~17 X-Git-Url: http://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=11b56a52390b3decde93e8efa5441b16b1842fae 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 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) {