mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-tools: When in test mode set process group in top-level ctdb tool
If ctdbd hangs when shutting down in post-test clean-up then killing the process group can kill the test. When in test mode, create a process group but only in the top-level ctdb tool - the natgw and lvs helpers also run the ctdb tool. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
3b0b830e40
commit
39206fd327
@ -6301,6 +6301,7 @@ int main(int argc, const char *argv[])
|
||||
const char **extra_argv;
|
||||
int extra_argc;
|
||||
const struct ctdb_cmd *cmd;
|
||||
const char *test_mode;
|
||||
int loglevel;
|
||||
bool ok;
|
||||
int ret = 0;
|
||||
@ -6375,6 +6376,16 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
debuglevel_set(loglevel);
|
||||
|
||||
/* Stop process group kill in alarm_handler() from killing tests */
|
||||
test_mode = getenv("CTDB_TEST_MODE");
|
||||
if (test_mode != NULL) {
|
||||
const char *have_setpgid = getenv("CTDB_TOOL_SETPGID");
|
||||
if (have_setpgid == NULL) {
|
||||
setpgid(0, 0);
|
||||
setenv("CTDB_TOOL_SETPGID", "1", 1);
|
||||
}
|
||||
}
|
||||
|
||||
signal(SIGALRM, alarm_handler);
|
||||
alarm(options.maxruntime);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user