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

Handle more gracefully signals sent by the terminal driver

When ctrl-c is pressed on the terminal, a signal (SIGINT)
is sent to all members of the foreground process group.

Since both wal_writer and logger processes' default action
on SIGINT is to terminate, they could terminate before parent.

This led to rather nasty results: in the circumstances, when
the parent somehow ignored SIGINT (e.g. under GDB), or handled
it after its children (a race condition), children would
disappear before parent, then parent would detect that
wal_writer is gone, try to panic/write to the log, which
is also gone, and on top of SIGINT get a SIGPIPE.

Move spawned children to their own process groups
to make sure they don't belong to the main process'
process group, and don't receive signals from the
controlling tty. It's okay in the interactive mode,
since these children are going to die anyway when the
parent dies, after getting a SIGPIPE.
parent 48392dc0
No related branches found
No related tags found
No related merge requests found
Loading
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