summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorTomas Korbar <tkorbar@redhat.com>2020-05-20 15:28:10 +0200
committerdormando <dormando@rydia.net>2020-05-27 15:11:01 -0700
commitcdeb988c28ca44d02e14c94467331af614cb976f (patch)
treefd57c629ad7c7cddb22d767dc636cf93e33d9b44 /thread.c
parentdf1315225a6273b66f4d2aaecd8197ea44627600 (diff)
downloadmemcached-cdeb988c28ca44d02e14c94467331af614cb976f.tar.gz
Do not join lru and slab maintainer threads if they do not exist
If no_modern option was supplied then these threads did not run but memcached still attempted to join them, which resulted in a segfault. resolve #685
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/thread.c b/thread.c
index f162d26..abbfca1 100644
--- a/thread.c
+++ b/thread.c
@@ -226,12 +226,16 @@ void stop_threads(void) {
stop_item_crawler_thread(CRAWLER_WAIT);
if (settings.verbose > 0)
fprintf(stderr, "stopped lru crawler\n");
- stop_lru_maintainer_thread();
- if (settings.verbose > 0)
- fprintf(stderr, "stopped maintainer\n");
- stop_slab_maintenance_thread();
- if (settings.verbose > 0)
- fprintf(stderr, "stopped slab mover\n");
+ if (settings.lru_maintainer_thread) {
+ stop_lru_maintainer_thread();
+ if (settings.verbose > 0)
+ fprintf(stderr, "stopped maintainer\n");
+ }
+ if (settings.slab_reassign) {
+ stop_slab_maintenance_thread();
+ if (settings.verbose > 0)
+ fprintf(stderr, "stopped slab mover\n");
+ }
logger_stop();
if (settings.verbose > 0)
fprintf(stderr, "stopped logger thread\n");