Fix issue where fork process deletes the parent pidfile (#8231)
Turns out that when the fork child crashes, the crash log was deleting the pidfile from the disk (although the parent is still running. Now we set the pidfile of the fork process to NULL so the fork process will never deletes it.
This commit is contained in:
parent
e7047ec2fc
commit
92a483bca2
@ -1808,7 +1808,7 @@ void bugReportEnd(int killViaSignal, int sig) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* free(messages); Don't call free() with possibly corrupted memory. */
|
/* free(messages); Don't call free() with possibly corrupted memory. */
|
||||||
if (server.daemonize && server.supervised == 0) unlink(server.pidfile);
|
if (server.daemonize && server.supervised == 0 && server.pidfile) unlink(server.pidfile);
|
||||||
|
|
||||||
if (!killViaSignal) {
|
if (!killViaSignal) {
|
||||||
if (server.use_exit_on_panic)
|
if (server.use_exit_on_panic)
|
||||||
|
@ -5200,6 +5200,10 @@ void closeClildUnusedResourceAfterFork() {
|
|||||||
closeListeningSockets(0);
|
closeListeningSockets(0);
|
||||||
if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1)
|
if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1)
|
||||||
close(server.cluster_config_file_lock_fd); /* don't care if this fails */
|
close(server.cluster_config_file_lock_fd); /* don't care if this fails */
|
||||||
|
|
||||||
|
/* Clear server.pidfile, this is the parent pidfile which should not
|
||||||
|
* be touched (or deleted) by the child (on exit / crash) */
|
||||||
|
server.pidfile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* purpose is one of CHILD_TYPE_ types */
|
/* purpose is one of CHILD_TYPE_ types */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user