From 3bd121781f621fae6ac4e054919ef68ab0f53c9e Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 19 Jun 2015 13:52:03 +0200 Subject: [PATCH] made a note in TODO and signal handler about SIGHUP and boost asio in case of time warp --- TODO | 4 ++++ src/main.cpp | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/TODO b/TODO index e5abd04..af647b4 100644 --- a/TODO +++ b/TODO @@ -15,3 +15,7 @@ In December 2014 / January 2015 did a lot of changes to ICMP pinger (IPv4) which Also, removed threads for each pingchecker, leaving only one thread with one io_service for all pingers. Tested that a lot with ICMP v4 pinger, but no other. + +If the system time is changed backwards, the pingchecker freezes, including its signal + handler (boost asio's deadline_timer seems to work with time points on a non-monotonic + clock). Change that! (apparently, boost asio 1.49 introduces a steady_timer, try that) diff --git a/src/main.cpp b/src/main.cpp index 9d27408..3c015ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -389,7 +389,21 @@ void signal_handler_usr2(int param) } -/// called regularly from io_service; checks signal_data.signal_flag +/** + * @brief called regularly from io_service; checks signal_data.signal_flag + * + * this does NOT work if there is a change in system time -- boost asio's + * deadline timers seem to operate on fixed time points on a non-monotonic + * clock; + * + * We therefore use external programs to kill pingchecker processes if the + * system clock changes; We use SIGHUP for this because it is not handled + * here and thus the default signal handler (which just kills the process + * without calling any destructors) avoids a freeze in here. SIGTERM would + * not work any more after system time change! + * + * --> do not catch SIGHUP in any asio-related signal handling! + */ void signal_checker( const boost::system::error_code &error ) { bool want_stop = false; -- 1.7.1