From edd6a13d5f4863afe31a10f00404381b547cab5c Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sun, 22 Nov 2020 17:09:46 +0000 Subject: [PATCH] redis: update patches Someone will need to fix threading, as using pthread_kill(t, 0) will most likely cause issues. Android does not provide pthread_cancel and similar. --- packages/redis/bio.c.patch | 24 ++++++------------------ packages/redis/networking.c.patch | 22 ++++++++++++++++++++++ packages/redis/server.c.patch | 14 ++++++++++++++ 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 packages/redis/networking.c.patch create mode 100644 packages/redis/server.c.patch diff --git a/packages/redis/bio.c.patch b/packages/redis/bio.c.patch index 9f36e6b56..fae5ce879 100644 --- a/packages/redis/bio.c.patch +++ b/packages/redis/bio.c.patch @@ -1,26 +1,14 @@ -diff -uNr redis-6.0.1/src/bio.c redis-6.0.1.mo/src/bio.c ---- redis-6.0.1/src/bio.c 2020-05-02 01:10:20.000000000 +0300 -+++ redis-6.0.1.mo/src/bio.c 2020-05-13 12:27:55.204680967 +0300 -@@ -166,11 +166,6 @@ - break; - } - -- /* Make the thread killable at any time, so that bioKillThreads() -- * can work reliably. */ -- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); -- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); -- - pthread_mutex_lock(&bio_mutex[type]); - /* Block SIGALRM so we are sure that only the main thread will - * receive the watchdog signal. */ -@@ -266,15 +261,7 @@ - int err, j; +diff -uNr redis-6.0.9/src/bio.c redis-6.0.9.mod/src/bio.c +--- redis-6.0.9/src/bio.c 2020-10-27 07:12:01.000000000 +0000 ++++ redis-6.0.9.mod/src/bio.c 2020-11-22 17:02:03.692060558 +0000 +@@ -266,15 +266,7 @@ for (j = 0; j < BIO_NUM_OPS; j++) { + if (bio_threads[j] == pthread_self()) continue; - if (bio_threads[j] && pthread_cancel(bio_threads[j]) == 0) { - if ((err = pthread_join(bio_threads[j],NULL)) != 0) { - serverLog(LL_WARNING, -- "Bio thread for job type #%d can be joined: %s", +- "Bio thread for job type #%d can not be joined: %s", - j, strerror(err)); - } else { - serverLog(LL_WARNING, diff --git a/packages/redis/networking.c.patch b/packages/redis/networking.c.patch new file mode 100644 index 000000000..0d9f61637 --- /dev/null +++ b/packages/redis/networking.c.patch @@ -0,0 +1,22 @@ +diff -uNr redis-6.0.9/src/networking.c redis-6.0.9.mod/src/networking.c +--- redis-6.0.9/src/networking.c 2020-10-27 07:12:01.000000000 +0000 ++++ redis-6.0.9.mod/src/networking.c 2020-11-22 17:06:47.317043042 +0000 +@@ -3082,16 +3082,8 @@ + int err, j; + for (j = 0; j < server.io_threads_num; j++) { + if (io_threads[j] == pthread_self()) continue; +- if (io_threads[j] && pthread_cancel(io_threads[j]) == 0) { +- if ((err = pthread_join(io_threads[j],NULL)) != 0) { +- serverLog(LL_WARNING, +- "IO thread(tid:%lu) can not be joined: %s", +- (unsigned long)io_threads[j], strerror(err)); +- } else { +- serverLog(LL_WARNING, +- "IO thread(tid:%lu) terminated",(unsigned long)io_threads[j]); +- } +- } ++ pthread_kill(io_threads[j], 0); ++ serverLog(LL_WARNING, "IO thread(tid:%lu) terminated",(unsigned long)io_threads[j]); + } + } + \ No newline at end of file diff --git a/packages/redis/server.c.patch b/packages/redis/server.c.patch new file mode 100644 index 000000000..2f4e9c385 --- /dev/null +++ b/packages/redis/server.c.patch @@ -0,0 +1,14 @@ +diff -uNr redis-6.0.9/src/server.c redis-6.0.9.mod/src/server.c +--- redis-6.0.9/src/server.c 2020-10-27 07:12:01.000000000 +0000 ++++ redis-6.0.9.mod/src/server.c 2020-11-22 17:03:52.033053867 +0000 +@@ -2813,8 +2813,10 @@ + * can work reliably (default cancelability type is PTHREAD_CANCEL_DEFERRED). + * Needed for pthread_cancel used by the fast memory test used by the crash report. */ + void makeThreadKillable(void) { ++#ifndef __ANDROID__ + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); ++#endif + } + + void initServer(void) {