mirror of
http://github.com/valkey-io/valkey
synced 2024-11-21 16:46:15 +00:00
Set errno to EEXIST in redisFork() if child process exists (#10059)
Callers of redisFork() are logging `strerror(errno)` on failure. `errno` is not set when there is already a child process, causing printing current value of errno which was set before `redisFork()` call. Setting errno to EEXIST on this failure to provide more meaningful error message.
This commit is contained in:
parent
5dd15443ac
commit
568c2e039b
@ -5937,8 +5937,10 @@ void closeChildUnusedResourceAfterFork() {
|
||||
/* purpose is one of CHILD_TYPE_ types */
|
||||
int redisFork(int purpose) {
|
||||
if (isMutuallyExclusiveChildType(purpose)) {
|
||||
if (hasActiveChildProcess())
|
||||
if (hasActiveChildProcess()) {
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
|
||||
openChildInfoPipe();
|
||||
}
|
||||
|
@ -32,4 +32,11 @@ start_server {tags {"modules"}} {
|
||||
assert {[count_log_message "fork child exiting"] eq "1"}
|
||||
}
|
||||
|
||||
test {Module fork twice} {
|
||||
r fork.create 0
|
||||
after 250
|
||||
catch {r fork.create 0}
|
||||
assert {[count_log_message "Can't fork for module: File exists"] eq "1"}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user