mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Reset signal mask before calling exec().
It might be non-empty and the child process might not expect this. For example, in one case we started clickhouse-odbc-bridge with blocked SIGTERM and then it didn't shutdown properly along with the server.
This commit is contained in:
parent
fbfa74e5c4
commit
dac83d2f9a
@ -119,6 +119,13 @@ std::unique_ptr<ShellCommand> ShellCommand::executeImpl(const char * filename, c
|
||||
_exit(int(ReturnCodes::CANNOT_DUP_STDERR));
|
||||
}
|
||||
|
||||
// Reset the signal mask: it may be non-empty and will be inherited
|
||||
// by the child process, which might not expect this.
|
||||
sigset_t mask;
|
||||
::sigemptyset(&mask);
|
||||
::sigprocmask(0, nullptr, &mask);
|
||||
::sigprocmask(SIG_UNBLOCK, &mask, nullptr);
|
||||
|
||||
execv(filename, argv);
|
||||
/// If the process is running, then `execv` does not return here.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user