summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-11-12 20:35:34 +0200
committerOran Agra <oran@redislabs.com>2022-12-12 17:36:34 +0200
commitabf83bc682f2bc0920033e8800a6896e20ecf7b7 (patch)
tree96b3b48dbf0d53372af594de5077b392a33ce740
parent7c956d5cdfbd682d6b4a464a7dc55d8152cf6f2b (diff)
downloadredis-abf83bc682f2bc0920033e8800a6896e20ecf7b7.tar.gz
fixes for fork child exit and test: #11463 (#11499)
Fix a few issues with the recent #11463 * use exitFromChild instead of exit * test should ignore defunct process since that's what we expect to happen for thees child processes when the parent dies. * fix typo Co-authored-by: Binbin <binloveplay1314@qq.com> (cherry picked from commit 4c54528f0fb56dec1373ead376a017b59743b04e)
-rw-r--r--src/childinfo.c2
-rw-r--r--tests/integration/replication.tcl2
-rw-r--r--tests/support/util.tcl1
3 files changed, 3 insertions, 2 deletions
diff --git a/src/childinfo.c b/src/childinfo.c
index e5184ff8b..1303dd043 100644
--- a/src/childinfo.c
+++ b/src/childinfo.c
@@ -114,7 +114,7 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, double progress,
if (write(server.child_info_pipe[1], &data, wlen) != wlen) {
/* Failed writing to parent, it could have been killed, exit. */
serverLog(LL_WARNING,"Child failed reporting info to parent, exiting. %s", strerror(errno));
- exit(1);
+ exitFromChild(1);
}
}
diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl
index 53fb44269..4acc28f75 100644
--- a/tests/integration/replication.tcl
+++ b/tests/integration/replication.tcl
@@ -1013,7 +1013,7 @@ test "diskless replication child being killed is collected" {
} {} {external:skip}
foreach mdl {yes no} {
- test "replication dies when parent is killed - diskless: $mdl" {
+ test "replication child dies when parent is killed - diskless: $mdl" {
# when master is killed, make sure the fork child can detect that and exit
start_server {tags {"repl"}} {
set master [srv 0 client]
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 5300ab1c8..1ed2621cb 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -637,6 +637,7 @@ proc process_is_alive pid {
if {[catch {exec ps -p $pid} err]} {
return 0
} else {
+ if {[string match "*<defunct>*" $err]} { return 0 }
return 1
}
}