Blame SOURCES/memcached-low-conns-segfault.patch

6dacf3
commit dfb7eb468f06dbcb9abca68c0ff3a89eb3bf80de
6dacf3
Author: dormando <dormando@rydia.net>
6dacf3
Date:   Thu Mar 26 12:51:27 2020 -0700
6dacf3
6dacf3
    fix startup segfault for low conns + idle thread
6dacf3
    
6dacf3
    < 100 connection limit plus idle_timeout feature caused a fault. Set a
6dacf3
    minimum sleep instead.
6dacf3
6dacf3
diff --git a/memcached.c b/memcached.c
6dacf3
index dd52dd0..6bfa131 100644
6dacf3
--- a/memcached.c
6dacf3
+++ b/memcached.c
6dacf3
@@ -341,7 +341,11 @@ static void *conn_timeout_thread(void *arg) {
6dacf3
     char buf[TIMEOUT_MSG_SIZE];
6dacf3
     rel_time_t oldest_last_cmd;
6dacf3
     int sleep_time;
6dacf3
-    useconds_t timeslice = 1000000 / (max_fds / CONNS_PER_SLICE);
6dacf3
+    int sleep_slice = max_fds / CONNS_PER_SLICE;
6dacf3
+    if (sleep_slice == 0)
6dacf3
+        sleep_slice = CONNS_PER_SLICE;
6dacf3
+
6dacf3
+    useconds_t timeslice = 1000000 / sleep_slice;
6dacf3
 
6dacf3
     while(do_run_conn_timeout_thread) {
6dacf3
         if (settings.verbose > 2)