summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-01-10 15:55:16 -0800
committerdormando <dormando@rydia.net>2023-01-10 15:55:16 -0800
commit8bb9d9a3e5ca93c38db97181d4c15b03d48a644d (patch)
treea4a0c01d1a4b4a61253d6fff2bc051a66fa31246
parent69d4248c097b67e6fd791cc5c186cc4054360c74 (diff)
downloadmemcached-1.6.18.tar.gz
core: do not stop threads on SIGINT/SIGTERM1.6.18
A change was accidentally introduced where part of the graceful shutdown code (stop_threads() -> close_conns()) would execute during non-graceful shutdown (INT/TERM). This could lead to hangs or bugs if using code that does not support graceful shutdown (proxy). This does not restore the old method of immediately exiting, and still frees some memory and returns from main(), but it no longer attempts to stop all the worker threads.
-rw-r--r--memcached.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/memcached.c b/memcached.c
index 2c17713..084aafd 100644
--- a/memcached.c
+++ b/memcached.c
@@ -6233,7 +6233,7 @@ int main (int argc, char **argv) {
// if we want to.
if (settings.verbose) {
- fprintf(stderr, "Signal handled\n");
+ fprintf(stderr, "Exiting normally\n");
}
break;
@@ -6242,9 +6242,11 @@ int main (int argc, char **argv) {
break;
}
- stop_threads();
- if (settings.memory_file != NULL && stop_main_loop == GRACE_STOP) {
- restart_mmap_close();
+ if (stop_main_loop == GRACE_STOP) {
+ stop_threads();
+ if (settings.memory_file != NULL) {
+ restart_mmap_close();
+ }
}
/* remove the PID file if we're a daemon */