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.
This commit is contained in:
Leonid Pliushch 2020-11-22 17:09:46 +00:00
parent 83c8db5cf8
commit edd6a13d5f
3 changed files with 42 additions and 18 deletions

View File

@ -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,

View File

@ -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]);
}
}

View File

@ -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) {