Skip to content
Snippets Groups Projects
Commit 1552874f authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'stable'

parents aaeef3c2 a57dc0d6
No related branches found
No related tags found
No related merge requests found
...@@ -290,9 +290,9 @@ replication_send_socket(ev_io *watcher, int events __attribute__((unused))) ...@@ -290,9 +290,9 @@ replication_send_socket(ev_io *watcher, int events __attribute__((unused)))
} }
/*-----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*
/* spawner process */ * spawner process *
/*-----------------------------------------------------------------------------*/ * -------------------------------------------------------------------------*/
/** Initialize the spawner. */ /** Initialize the spawner. */
...@@ -336,6 +336,21 @@ spawner_init(int sock) ...@@ -336,6 +336,21 @@ spawner_init(int sock)
if (sigaction(SIGCHLD, &sa, NULL) == -1) if (sigaction(SIGCHLD, &sa, NULL) == -1)
say_syserror("sigaction"); say_syserror("sigaction");
sa.sa_handler = SIG_IGN;
/*
* Ignore SIGUSR1, SIGUSR1 is used to make snapshots,
* and if someone wrote a faulty regexp for `ps' and
* fed it to `kill' the replication shouldn't die.
*/
if (sigaction(SIGUSR1, &sa, NULL) == -1)
say_syserror("sigaction");
/*
* Ignore SIGUSR2 as well, since one can be pretty
* inventive in ways of shooting oneself in the foot.
*/
if (sigaction(SIGUSR2, &sa, NULL) == -1)
say_syserror("sigaction");
say_crit("initialized"); say_crit("initialized");
spawner_main_loop(); spawner_main_loop();
} }
...@@ -397,6 +412,15 @@ spawner_main_loop() ...@@ -397,6 +412,15 @@ spawner_main_loop()
static void static void
spawner_shutdown() spawner_shutdown()
{ {
/*
* There is no need to ever use signals with the spawner
* process. If someone did send spawner a signal by
* mistake, at least make a squeak in the error log before
* dying.
*/
if (spawner.killed)
say_info("Terminated by signal %d", (int) spawner.killed);
/* close socket */ /* close socket */
close(spawner.sock); close(spawner.sock);
...@@ -612,10 +636,23 @@ replication_relay_loop(int client_sock) ...@@ -612,10 +636,23 @@ replication_relay_loop(int client_sock)
sigaction(SIGTERM, &sa, NULL) == -1) sigaction(SIGTERM, &sa, NULL) == -1)
say_syserror("sigaction"); say_syserror("sigaction");
/* Block SIGPIPE, we already handle EPIPE. */ /* Ignore SIGPIPE, we already handle EPIPE. */
sa.sa_handler = SIG_IGN; sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL) == -1) if (sigaction(SIGPIPE, &sa, NULL) == -1)
say_syserror("sigaction"); say_syserror("sigaction");
/*
* Ignore SIGUSR1, SIGUSR1 is used to make snapshots,
* and if someone wrote a faulty regexp for `ps' and
* fed it to `kill' the replication shouldn't die.
*/
if (sigaction(SIGUSR1, &sa, NULL) == -1)
say_syserror("sigaction");
/*
* Ignore SIGUSR2 as well, since one can be pretty
* inventive in ways of shooting oneself in the foot.
*/
if (sigaction(SIGUSR2, &sa, NULL) == -1)
say_syserror("sigaction");
r = read(client_sock, &lsn, sizeof(lsn)); r = read(client_sock, &lsn, sizeof(lsn));
if (r != sizeof(lsn)) { if (r != sizeof(lsn)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment