Percona Server with XtraDB

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

Reported by Laurynas Biveinis on 2012-10-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server
Undecided
Laurynas Biveinis
5.1
Undecided
Laurynas Biveinis
5.5
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);

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

Other bug subscribers

Remote bug watches

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