Skip to content
Snippets Groups Projects
Commit 06047590 authored by Mark A. Grondona's avatar Mark A. Grondona Committed by Morris Jette
Browse files

slurmstepd: unblock all signals before invoking user job

It was found that slurmstepd was intermittently leaving SIGPIPE
blocked when launching user tasks. This may have something to do
with the fact that the xsignal_unblock() call in _fork_all_tasks()
is referencing an extern array (nominally this should have unblocked
SIGPIPE), but I didn't spend the time to fully track this issue
down. Instead, I figured there is probably no reason we would _not_
want to unblock *all* signals, so this patch does that.

Before this change, the following program fails every once in awhile:

 #include <stdio.h>
 #include <signal.h>

 int main (int ac, char **av)
 {
	int i, rc = 0;
	struct sigaction act;
	for (i = 1; i < SIGRTMAX; i++) {
		sigaction (i, NULL, &act);
		if (act.sa_handler == SIG_DFL)
			continue;
		fprintf (stderr, "Signal %d appears to be ignored!\n", i);
		rc = 1;
	}
	return (rc);
 }

with:

 srun -N1 -n1 ./test
 Signal 13 appears to be ignored!

after the change, the program succeeds.
parent adf582b0
No related branches found
No related tags found
No related merge requests found
......@@ -1207,6 +1207,13 @@ static void prepare_stdio (slurmd_job_t *job, slurmd_task_info_t *task)
return;
}
static void unblock_signals (void)
{
sigset_t set;
sigemptyset(&set);
xsignal_set_mask (&set);
}
/* fork and exec N tasks
*/
static int
......@@ -1319,7 +1326,7 @@ _fork_all_tasks(slurmd_job_t *job)
/* log_fini(); */ /* note: moved into exec_task() */
xsignal_unblock(slurmstepd_blocked_signals);
unblock_signals();
/*
* Need to setup stdio before setpgid() is called
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment