Commit abf83bc6 authored by Oran Agra's avatar Oran Agra
Browse files

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: default avatarBinbin <binloveplay1314@qq.com>
(cherry picked from commit 4c54528f)
parent 7c956d5c
...@@ -114,7 +114,7 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, double progress, ...@@ -114,7 +114,7 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, double progress,
if (write(server.child_info_pipe[1], &data, wlen) != wlen) { if (write(server.child_info_pipe[1], &data, wlen) != wlen) {
/* Failed writing to parent, it could have been killed, exit. */ /* Failed writing to parent, it could have been killed, exit. */
serverLog(LL_WARNING,"Child failed reporting info to parent, exiting. %s", strerror(errno)); serverLog(LL_WARNING,"Child failed reporting info to parent, exiting. %s", strerror(errno));
exit(1); exitFromChild(1);
} }
} }
......
...@@ -1013,7 +1013,7 @@ test "diskless replication child being killed is collected" { ...@@ -1013,7 +1013,7 @@ test "diskless replication child being killed is collected" {
} {} {external:skip} } {} {external:skip}
foreach mdl {yes no} { 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 # when master is killed, make sure the fork child can detect that and exit
start_server {tags {"repl"}} { start_server {tags {"repl"}} {
set master [srv 0 client] set master [srv 0 client]
......
...@@ -637,6 +637,7 @@ proc process_is_alive pid { ...@@ -637,6 +637,7 @@ proc process_is_alive pid {
if {[catch {exec ps -p $pid} err]} { if {[catch {exec ps -p $pid} err]} {
return 0 return 0
} else { } else {
if {[string match "*<defunct>*" $err]} { return 0 }
return 1 return 1
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment