MDEV-7448 - mtr may leave stale mysqld
Let mtr handle SIGHUP the same way as SIGINT. This solves stale mysqld processes left after broken/closed ssh connection.
This commit is contained in:
parent
d9d994089f
commit
ca6b86f420
@ -180,6 +180,7 @@ sub create_process {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$SIG{INT}= 'DEFAULT';
|
$SIG{INT}= 'DEFAULT';
|
||||||
|
$SIG{HUP}= 'DEFAULT';
|
||||||
|
|
||||||
# Make this process it's own process group to be able to kill
|
# Make this process it's own process group to be able to kill
|
||||||
# it and any childs(that hasn't changed group themself)
|
# it and any childs(that hasn't changed group themself)
|
||||||
|
@ -141,6 +141,7 @@ extern "C" void handle_signal(int sig)
|
|||||||
// Ignore further signals
|
// Ignore further signals
|
||||||
signal(SIGTERM, SIG_IGN);
|
signal(SIGTERM, SIG_IGN);
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
|
signal(SIGHUP, SIG_IGN);
|
||||||
|
|
||||||
// Continune execution, allow the child to be started and
|
// Continune execution, allow the child to be started and
|
||||||
// finally terminated by monitor loop
|
// finally terminated by monitor loop
|
||||||
@ -164,6 +165,7 @@ int main(int argc, char* const argv[] )
|
|||||||
/* Install signal handlers */
|
/* Install signal handlers */
|
||||||
sigaction(SIGTERM, &sa,NULL);
|
sigaction(SIGTERM, &sa,NULL);
|
||||||
sigaction(SIGINT, &sa,NULL);
|
sigaction(SIGINT, &sa,NULL);
|
||||||
|
sigaction(SIGHUP, &sa, NULL);
|
||||||
sigaction(SIGCHLD, &sa,NULL);
|
sigaction(SIGCHLD, &sa,NULL);
|
||||||
sigaction(SIGABRT, &sa_abort,NULL);
|
sigaction(SIGABRT, &sa_abort,NULL);
|
||||||
|
|
||||||
@ -231,6 +233,7 @@ int main(int argc, char* const argv[] )
|
|||||||
// Use default signal handlers in child
|
// Use default signal handlers in child
|
||||||
signal(SIGTERM, SIG_DFL);
|
signal(SIGTERM, SIG_DFL);
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
|
signal(SIGHUP, SIG_DFL);
|
||||||
signal(SIGCHLD, SIG_DFL);
|
signal(SIGCHLD, SIG_DFL);
|
||||||
|
|
||||||
// Make this process it's own process group to be able to kill
|
// Make this process it's own process group to be able to kill
|
||||||
|
@ -109,6 +109,7 @@ require "lib/mtr_gprof.pl";
|
|||||||
require "lib/mtr_misc.pl";
|
require "lib/mtr_misc.pl";
|
||||||
|
|
||||||
$SIG{INT}= sub { mtr_error("Got ^C signal"); };
|
$SIG{INT}= sub { mtr_error("Got ^C signal"); };
|
||||||
|
$SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); };
|
||||||
|
|
||||||
our $mysql_version_id;
|
our $mysql_version_id;
|
||||||
my $mysql_version_extra;
|
my $mysql_version_extra;
|
||||||
@ -908,6 +909,7 @@ sub run_worker ($) {
|
|||||||
my ($server_port, $thread_num)= @_;
|
my ($server_port, $thread_num)= @_;
|
||||||
|
|
||||||
$SIG{INT}= sub { exit(1); };
|
$SIG{INT}= sub { exit(1); };
|
||||||
|
$SIG{HUP}= sub { exit(1); };
|
||||||
|
|
||||||
# Connect to server
|
# Connect to server
|
||||||
my $server = new IO::Socket::INET
|
my $server = new IO::Socket::INET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user