safe_process.cc/safe_process.pl should not kill mysqld on SIGSTOP/SIGCONT

Bug #1060136 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Undecided
Laurynas Biveinis
5.1
Fix Released
Undecided
Laurynas Biveinis
5.5
Fix Released
Undecided
Laurynas Biveinis

Bug Description

For Percona Server, this is prerequisite in testing bug 805805 fix in MTR.

Upstream description:

Description:
Currently safe_process.cc (and probably safe_process.pl too) handles SIGCHLD as if its child was terminated. That's the case for SIGTERM, SIGKILL etc. But safe_process also receives SIGCHLD for SIGSTOP, SIGCONT etc, which are non-fatal to the child.

How to repeat:
--source include/not_windows.inc

let $mysqld_pid_file=`SELECT @@GLOBAL.pid_file`;

system kill -STOP `cat $mysqld_pid_file`;
system kill -CONT `cat $mysqld_pid_file`;

# Server gone!
SELECT 2+2;

Suggested fix:
SIGCHLD handler should be installed with SA_NOCLDSTOP option:

@@ -152,11 +152,15 @@
   pid_t own_pid= getpid();
   pid_t parent_pid= getppid();
   bool nocore = false;
+ struct sigaction sigchld_action;
+
+ sigchld_action.sa_handler= handle_signal;
+ sigchld_action.sa_flags= SA_NOCLDSTOP;

   /* Install signal handlers */
   signal(SIGTERM, handle_signal);
   signal(SIGINT, handle_signal);
- signal(SIGCHLD, handle_signal);
+ sigaction(SIGCHLD, &sigchld_action, NULL);
   signal(SIGABRT, handle_abort);

   sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);

Related branches

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2812

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.