Skip to content

Commit 521f04d

Browse files
authored
Merge pull request #5928 from hjelmn/v3.0.x_need_to_unblock_sigchld_in_some_cases
v3.0.x: Ensure SIGCHLD is unblocked
2 parents fe4375a + f4fe63b commit 521f04d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

orte/mca/odls/base/odls_base_frame.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "orte/constants.h"
2929

3030
#include <string.h>
31+
#include <signal.h>
3132

3233
#include "opal/class/opal_ring_buffer.h"
3334
#include "orte/mca/mca.h"
@@ -140,6 +141,7 @@ static int orte_odls_base_open(mca_base_open_flag_t flags)
140141
int rc, i, rank;
141142
orte_namelist_t *nm;
142143
bool xterm_hold;
144+
sigset_t unblock;
143145

144146
/* initialize the global array of local children */
145147
orte_local_children = OBJ_NEW(opal_pointer_array_t);
@@ -155,6 +157,17 @@ static int orte_odls_base_open(mca_base_open_flag_t flags)
155157
OBJ_CONSTRUCT(&orte_odls_globals.xterm_ranks, opal_list_t);
156158
orte_odls_globals.xtermcmd = NULL;
157159

160+
/* ensure that SIGCHLD is unblocked as we need to capture it */
161+
if (0 != sigemptyset(&unblock)) {
162+
return ORTE_ERROR;
163+
}
164+
if (0 != sigaddset(&unblock, SIGCHLD)) {
165+
return ORTE_ERROR;
166+
}
167+
if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) {
168+
return ORTE_ERR_NOT_SUPPORTED;
169+
}
170+
158171
/* check if the user requested that we display output in xterms */
159172
if (NULL != orte_xterm) {
160173
/* construct a list of ranks to be displayed */

0 commit comments

Comments
 (0)