Bedrock currently ignores the proscribed behavior of most of the signals defined
in:
POSIX.1-1990
POSIX.1-2001
4.2BSD
4.4BSD
SVr4
Sys V
There are five basic actions defined for signal handling as per the POSIX
programmers manual:
T Abnormal termination of the process.
A Abnormal termination of the process with additional actions.
I Ignore the signal.
S Stop the process.
C Continue the process, if it is stopped; otherwise, ignore the signal.
The effects on the process in each case are described in the System Interfaces
volume of POSIX.1โ2008, Section 2.4.3, Signal Actions.
Additionally, the signals defined as per the POSIX programmers manual are as
follows:
The ISO C standard only requires the signal names SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, and SIGTERM to be defined.
The following signals shall be supported on all implementations (default actions are explained below the table):
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Signal โ Default Action โ Description โ
โโโโโโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โSIGABRT โ A โ Process abort signal. โ
โSIGALRM โ T โ Alarm clock. โ
โSIGBUS โ A โ Access to an undefined portion of a memory object. โ
โSIGCHLD โ I โ Child process terminated, stopped, โ
โ โ โ or continued. โ
โSIGCONT โ C โ Continue executing, if stopped. โ
โSIGFPE โ A โ Erroneous arithmetic operation. โ
โSIGHUP โ T โ Hangup. โ
โSIGILL โ A โ Illegal instruction. โ
โSIGINT โ T โ Terminal interrupt signal. โ
โSIGKILL โ T โ Kill (cannot be caught or ignored). โ
โSIGPIPE โ T โ Write on a pipe with no one to read it. โ
โSIGQUIT โ A โ Terminal quit signal. โ
โSIGSEGV โ A โ Invalid memory reference. โ
โSIGSTOP โ S โ Stop executing (cannot be caught or ignored). โ
โSIGTERM โ T โ Termination signal. โ
โSIGTSTP โ S โ Terminal stop signal. โ
โSIGTTIN โ S โ Background process attempting read. โ
โSIGTTOU โ S โ Background process attempting write. โ
โSIGUSR1 โ T โ User-defined signal 1. โ
โSIGUSR2 โ T โ User-defined signal 2. โ
โSIGPOLL โ T โ Pollable event. โ
โSIGPROF โ T โ Profiling timer expired. โ
โSIGSYS โ A โ Bad system call. โ
โSIGTRAP โ A โ Trace/breakpoint trap. โ
โSIGURG โ I โ High bandwidth data is available at a socket. โ
โSIGVTALRM โ T โ Virtual timer expired. โ
โSIGXCPU โ A โ CPU time limit exceeded. โ
โSIGXFSZ โ A โ File size limit exceeded. โ
โ โ โ โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Currently Bedrock's behavior is to only watch for the following signals:
- SIGQUIT
- SIGTTIN
- SIGTTOU
- SIGUSR2
In the event of any other signal it will exit as per BedrockServer.cpp#L495:
// For anything else, just shutdown -- but only if we're not already shutting down
This means that if the system is attempting to notify the host of a change in
window size (SIGWINCH
), the system will exit. While it is the prerogative of
Bedrock to decide how to respond to signals, it seems naive to quit on signals
which the Linux man pages (man 7 signal
) proscribe a default behavior of
"ignore" (as is the case of SIGCONT
).
In testing, I confirmed that Bedrock exited in all of the following cases:
(BedrockServer.cpp:506) postSelect [main] [info] Beginning graceful shutdown due
to 'SIGCONT, (unknown#50)', closing command port on 'localhost:8888'
(BedrockServer.cpp:506) postSelect [main] [info] Beginning graceful shutdown due
to 'SIGINT, (unknown#34)', closing command port on 'localhost:8888'
(BedrockServer.cpp:506) postSelect [main] [info] Beginning graceful shutdown due
to 'SIGURG, (unknown#55)', closing command port on 'localhost:8888'
(BedrockServer.cpp:506) postSelect [main] [info] Beginning graceful shutdown due
to 'SIGUSR1, (unknown#42)', closing command port on 'localhost:8888'
(BedrockServer.cpp:506) postSelect [main] [info] Beginning graceful shutdown due
to 'SIGWINCH, (unknown#60)', closing command port on 'localhost:8888'
This was discovered while running Bedrock conncurrently with a piece of software
containing a memory leak which, during page swapping, issued SIGWINCH
.
This issue also raises concerns about the ability to trigger a core dump for
analysis of a running system.