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

Submitted: 2 Oct 2012 11:18 Modified: 22 Apr 2013 16:52
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: System Severity:S3 (Non-critical)
Version:5.1, 5.5, 5.7.0, 5.5.29, 5.1.67 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution, safe_process

[2 Oct 2012 11:18] Laurynas Biveinis
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);
[12 Oct 2012 19:18] Sveta Smirnova
Thank you for the report.

Verified as described.
[7 Feb 2013 5:54] Laurynas Biveinis
Fixed in 5.1 revno 3871.

Sadly the commit does not mention "67052" in addition to the internal bug #.

Bug #14757120 - SAFE_PROCESS.CC/SAFE_PROCESS.PL SHOULD NOT KILL MYSQLD ON SIGSTOP/SIGCONT

This bug may be closed as fixed now.
[20 Apr 2013 12:56] Laurynas Biveinis
Any news on closing this bug?

Thanks.
[22 Apr 2013 10:43] Sayantan Dutta
its been fixed!
[22 Apr 2013 16:52] Laurynas Biveinis
The reason I asked, instead of closing this bug myself, which I can do as the submitter, is because Oracle usually adds the release notes entries upon closing.
[24 Apr 2013 15:25] Paul DuBois
Changes to test suite. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.