1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Support SIGABRT to generate coredump.

This commit is contained in:
winlin 2022-05-25 12:16:06 +08:00
parent 1d503c770f
commit 0304e78cf1
2 changed files with 14 additions and 0 deletions

View file

@ -295,6 +295,11 @@ srs_error_t SrsSignalManager::start()
sa.sa_flags = 0;
sigaction(SRS_SIGNAL_GRACEFULLY_QUIT, &sa, NULL);
sa.sa_handler = SrsSignalManager::sig_catcher;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SRS_SIGNAL_ASSERT_ABORT, &sa, NULL);
sa.sa_handler = SrsSignalManager::sig_catcher;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
@ -971,6 +976,13 @@ srs_error_t SrsServer::cycle()
void SrsServer::on_signal(int signo)
{
// For signal to quit with coredump.
if (signo == SRS_SIGNAL_ASSERT_ABORT) {
srs_trace("abort with coredump, signo=%d", signo);
srs_assert(false);
return;
}
if (signo == SRS_SIGNAL_RELOAD) {
srs_trace("reload config, signo=%d", signo);
signal_reload = true;

View file

@ -125,6 +125,8 @@
// The signal for srs to gracefully quit, do carefully dispose then exit.
// @see https://github.com/ossrs/srs/issues/1579
#define SRS_SIGNAL_GRACEFULLY_QUIT SIGQUIT
// The signal for SRS to abort by assert(false).
#define SRS_SIGNAL_ASSERT_ABORT SIGABRT
// The application level signals.
// Persistence the config in memory to config file.