1
1

Per discussion on email thread, restore placement of child procs in their own process group so that any signal sent to one of our children is automatically propagated to any child process they might have spawned.

Signed-off-by: Ralph Castain <rhc@open-mpi.org>
Этот коммит содержится в:
Ralph Castain 2016-12-02 03:36:22 -08:00
родитель b2e36f0824
Коммит 88313debc2
2 изменённых файлов: 21 добавлений и 2 удалений

Просмотреть файл

@ -1466,7 +1466,7 @@ int orte_odls_base_default_kill_local_procs(opal_pointer_array_t *procs,
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(procptr, i))) { if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(procptr, i))) {
continue; continue;
} }
for(j=0; j < orte_local_children->size; j++) { for (j=0; j < orte_local_children->size; j++) {
if (NULL == (child = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, j))) { if (NULL == (child = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, j))) {
continue; continue;
} }

Просмотреть файл

@ -167,6 +167,22 @@ orte_odls_base_module_t orte_odls_default_module = {
/* deliver a signal to a specified pid. */ /* deliver a signal to a specified pid. */
static int odls_default_kill_local(pid_t pid, int signum) static int odls_default_kill_local(pid_t pid, int signum)
{ {
pid_t pgrp;
#if HAVE_SETPGID
pgrp = getpgid(pid);
if (-1 != pgrp) {
/* target the lead process of the process
* group so we ensure that the signal is
* seen by all members of that group. This
* ensures that the signal is seen by any
* child processes our child may have
* started
*/
pid = pgrp;
}
#endif
if (0 != kill(pid, signum)) { if (0 != kill(pid, signum)) {
if (ESRCH != errno) { if (ESRCH != errno) {
OPAL_OUTPUT_VERBOSE((2, orte_odls_base_framework.framework_output, OPAL_OUTPUT_VERBOSE((2, orte_odls_base_framework.framework_output,
@ -313,6 +329,10 @@ static int do_child(orte_app_context_t* context,
long fd, fdmax = sysconf(_SC_OPEN_MAX); long fd, fdmax = sysconf(_SC_OPEN_MAX);
char *param, *msg; char *param, *msg;
/* Set a new process group for this child, so that any
* signals we send to it will reach any children it spawns */
setpgid(0, 0);
/* Setup the pipe to be close-on-exec */ /* Setup the pipe to be close-on-exec */
opal_fd_set_cloexec(write_fd); opal_fd_set_cloexec(write_fd);
@ -717,4 +737,3 @@ static int orte_odls_default_restart_proc(orte_proc_t *child)
} }
return rc; return rc;
} }