From 927c0c8e398e9fbc0d2e43f19b60f4cdb805b5e4 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 11 Mar 2020 19:04:52 +0800 Subject: [PATCH] For #1634, fix quit by accident SIGTERM while killing FFMPEG. 3.0.124 --- README.md | 2 ++ trunk/src/app/srs_app_process.cpp | 4 ++++ trunk/src/app/srs_app_server.cpp | 7 ++++--- trunk/src/core/srs_core_version3.hpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da2fed7f8..ca451c970 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-03-11, For [#1634][bug #1634], fix quit by accident SIGTERM while killing FFMPEG. 3.0.124 * v3.0, 2020-03-05, [3.0 beta2(3.0.123)][r3.0b2] released. 122170 lines. * v3.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 3.0.123 * v3.0, 2020-02-21, Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122 @@ -1660,6 +1661,7 @@ Winlin [bug #1601]: https://github.com/ossrs/srs/issues/1601 [bug #1579]: https://github.com/ossrs/srs/issues/1579 [bug #1598]: https://github.com/ossrs/srs/issues/1598 +[bug #1634]: https://github.com/ossrs/srs/issues/1634 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/app/srs_app_process.cpp b/trunk/src/app/srs_app_process.cpp index 8ccc1b72e..0f12f493d 100644 --- a/trunk/src/app/srs_app_process.cpp +++ b/trunk/src/app/srs_app_process.cpp @@ -248,6 +248,10 @@ srs_error_t SrsProcess::start() // parent. if (pid > 0) { + // Wait for a while for process to really started. + // @see https://github.com/ossrs/srs/issues/1634#issuecomment-597568840 + srs_usleep(10 * SRS_UTIME_MILLISECONDS); + is_started = true; srs_trace("fored process, pid=%d, bin=%s, stdout=%s, stderr=%s, argv=%s", pid, bin.c_str(), stdout_file.c_str(), stderr_file.c_str(), actual_cli.c_str()); diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 9cffa3250..99724f993 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -892,6 +892,7 @@ srs_error_t SrsServer::cycle() void SrsServer::on_signal(int signo) { if (signo == SRS_SIGNAL_RELOAD) { + srs_trace("reload config, signo=%d", signo); signal_reload = true; return; } @@ -899,7 +900,7 @@ void SrsServer::on_signal(int signo) #ifndef SRS_AUTO_GPERF_MC if (signo == SRS_SIGNAL_REOPEN_LOG) { _srs_log->reopen(); - srs_warn("reopen log file"); + srs_warn("reopen log file, signo=%d", signo); return; } #endif @@ -907,7 +908,7 @@ void SrsServer::on_signal(int signo) #ifdef SRS_AUTO_GPERF_MC if (signo == SRS_SIGNAL_REOPEN_LOG) { signal_gmc_stop = true; - srs_warn("for gmc, the SIGUSR1 used as SIGINT"); + srs_warn("for gmc, the SIGUSR1 used as SIGINT, signo=%d", signo); return; } #endif @@ -919,7 +920,7 @@ void SrsServer::on_signal(int signo) if (signo == SIGINT) { #ifdef SRS_AUTO_GPERF_MC - srs_trace("gmc is on, main cycle will terminate normally."); + srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo); signal_gmc_stop = true; #else #ifdef SRS_AUTO_MEM_WATCH diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index c871670b0..982408222 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 123 +#define SRS_VERSION3_REVISION 124 #endif