Skip to content

Commit 853c7e3

Browse files
grondomergify[bot]
authored andcommitted
job-exec: do not try to re-send J to multi-user job with no stdin
Problem: When reattaching to a multiuser sdexec job, sdexec always tries to re-send the input to the IMP (J), even though the stdin fd is set to -1. This generates EBADF and a fatal error for the job. Only send input to the IMP if the current stdin fd is valid. This effectively avoids resend of J for jobs that were already started.
1 parent 08ae1cd commit 853c7e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/modules/job-exec/sdexec.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ static void state_cb (sdprocess_t *sdp, sdprocess_state_t state, void *arg)
364364
jobinfo_started (se->job);
365365

366366
if (state == SDPROCESS_ACTIVE) {
367-
if (se->job->multiuser) {
367+
/* Don't try to write J to stdin_fd of -1
368+
* This probably indicates we've reattached to this job
369+
*/
370+
if (se->job->multiuser && se->stdin_fds[0] >= 0) {
368371
char *input = NULL;
369372
json_t *o = json_pack ("{s:s}", "J", se->job->J);
370373
if (!o || !(input = json_dumps (o, JSON_COMPACT))) {

0 commit comments

Comments
 (0)