From 961ead7ebf855bcb53728734c828378c187f23ce Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Mon, 9 May 2016 15:15:26 +0600 Subject: [PATCH] statsd plugin: Fix deadlock on plugin shutdown (Issue #1703) --- src/statsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/statsd.c b/src/statsd.c index 7336d37a..ba8901b9 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -936,8 +936,6 @@ static int statsd_shutdown (void) /* {{{ */ void *key; void *value; - pthread_mutex_lock (&metrics_lock); - if (network_thread_running) { network_thread_shutdown = 1; @@ -946,6 +944,8 @@ static int statsd_shutdown (void) /* {{{ */ } network_thread_running = 0; + pthread_mutex_lock (&metrics_lock); + while (c_avl_pick (metrics_tree, &key, &value) == 0) { sfree (key); -- 2.11.0