Add flag to treat SIGHUP/SIGUSR1 as termination#269
Add flag to treat SIGHUP/SIGUSR1 as termination#269alangefe wants to merge 1 commit intoCESNET:devel-serverfrom
Conversation
`netopeer2-server`'s signal handler currently attempts to restart netopeer2-server if it receives `SIGHUP` or `SIGUSR1`. Unfortunately, we've noticed several problems with the server restart mechanism. For example, libssh's thread.c does not properly clean up its state, so netopeer2-server crashes with a segmentation fault when restarting. This pull request does not attempt to address any of the problems with the server restart mechanism. Instead, it adds an optional configuration flag `DISABLE_RESTART_SIGNALS` that allows us to treat `SIGHUP` and `SIGUSR1` as signals that will _terminate_ the server instead of restarting it. The flag is disabled by default, so the existing behavior remains unchanged.
So that init can be safely called again. Refs CESNET/netopeer2#269
|
Hi Andrew, On the other hand, we would not want to add a lot of options with little use so may I ask what exactly is the problem? That the restart does not work perfectly? Or you do not want to allow it at all? Based on libssh mailing list I believe that the new version should fix many bugs and especially be compatible with most recent OpenSSL even though we may still wait for it for quite some time. Regards, |
|
Hi Michal, Our main concern is the libssh initialization problem after the restart. We don't presently have a need for the server restart on SIGHUP/SIGUSR1, so we were opting for a clean termination instead of the libssh segfault. The libssh problem is replicable when using libssh 0.7.5 and the openssl 1.0.2 branch. Here's a stack trace of the crash after server restart:
Looking upstack, we can see that Regards, |
This feature required proper init/cleanup of libssh and OpenSSL which was not achieved with all version combinations. System scripts that may need to restart netopeer2 can simply terminate it and start it again. Fixes #269
|
Hi Andrew, Regards, |
netopeer2-server's signal handler currently attempts to restart netopeer2-server if it receivesSIGHUPorSIGUSR1. Unfortunately, we've noticed several problems with the server restart mechanism. For example, libssh's thread.c does not properly clean up its state, so netopeer2-server crashes with a segmentation fault when restarting.This pull request does not attempt to address any of the problems with the server restart mechanism. Instead, it adds an optional configuration flag
DISABLE_RESTART_SIGNALSthat allows us to treatSIGHUPandSIGUSR1as signals that will terminate the server instead of restarting it. The flag is disabled by default, so the existing behavior remains unchanged.