diff options
author | antirez <antirez@gmail.com> | 2019-03-31 22:06:00 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2019-05-06 18:02:51 +0200 |
commit | 8d7d2be24fb74234603667e8da4de2d2f466aff1 (patch) | |
tree | 4b15b70cd3f922433967f7d9322e197cb560ce3c | |
parent | 63a0ffd36a99083b909e2110a7604fe335656a8d (diff) | |
download | redis-8d7d2be24fb74234603667e8da4de2d2f466aff1.tar.gz |
Threaded IO: process read queue before stopping threads.
-rw-r--r-- | src/networking.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/networking.c b/src/networking.c index 3a36badb8..29a56e983 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2590,8 +2590,13 @@ void startThreadedIO(void) { } void stopThreadedIO(void) { + /* We may have still clients with pending reads when this function + * is called: handle them before stopping the threads. */ + handleClientsWithPendingReadsUsingThreads(); if (tio_debug) printf("E"); fflush(stdout); - if (tio_debug) printf("--- STOPPING THREADED IO ---\n"); + if (tio_debug) printf("--- STOPPING THREADED IO [R%d] [W%d] ---\n", + (int) listLength(server.clients_pending_read), + (int) listLength(server.clients_pending_write)); serverAssert(io_threads_active == 1); for (int j = 0; j < server.io_threads_num; j++) pthread_mutex_lock(&io_threads_mutex[j]); |