Skip to content

Commit da7a958

Browse files
committed
testsuite: block SIGCHLD in "test server"
Problem: libsubprocess unit tests occasionally hang when run with a reactor that uses EVFLAG_NOSIGMASK, which may be required. Block SIGCHLD in the test server before spawning threads to avoid it being delivered to the client thread occasionally.
1 parent fbaff6d commit da7a958

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/common/libtestutil/util.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ flux_t *test_server_create (int cflags, test_server_f cb, void *arg)
123123
char uri[64];
124124
flux_reactor_t *r;
125125

126+
/* To support libsubprocess's SIGCHLD watcher in the server thread,
127+
* block SIGCHLD before spawning threads to avoid it being delivered
128+
* to the client thread occasionally.
129+
*/
130+
sigset_t sigmask;
131+
sigemptyset (&sigmask);
132+
sigaddset (&sigmask, SIGCHLD);
133+
if (sigprocmask (SIG_BLOCK, &sigmask, NULL) < 0)
134+
BAIL_OUT ("sigprocmask failed");
135+
126136
if (!(a = calloc (1, sizeof (*a))))
127137
BAIL_OUT ("calloc");
128138
a->cb = cb;
@@ -134,7 +144,6 @@ flux_t *test_server_create (int cflags, test_server_f cb, void *arg)
134144
if (getenv ("FLUX_HANDLE_TRACE"))
135145
cflags |= FLUX_O_TRACE;
136146

137-
138147
/* Create back-to-back wired flux_t handles.
139148
* Give the server side a SIGCHLD capable reactor for subprocess testing.
140149
*/

0 commit comments

Comments
 (0)