Skip to content

Commit

Permalink
Merge pull request #3220 from chu11/issue3218_job_manager_segfault
Browse files Browse the repository at this point in the history
job-manager: fix segfault when attempting to change priority of a running job
  • Loading branch information
mergify[bot] committed Sep 22, 2020
2 parents afc3396 + 5cd9da5 commit 1c231cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/job-manager/priority.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ void priority_handle_request (flux_t *h,
errno = EINVAL;
goto error;
}
if (job->has_resources) {
errstr = "priority cannot be changed once resources are allocated";
errno = EINVAL;
goto error;
}
/* Post event, change job's queue position, and respond.
*/
if (event_job_post_pack (ctx->event, job,
Expand Down
4 changes: 4 additions & 0 deletions t/t2201-job-cmd.t
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ test_expect_success 'flux-job: priority fails with non-numeric priority' '
test_must_fail flux job priority ${validjob} foo
'

test_expect_success 'job-manager: flux job priority fails on invalid jobid' '
test_must_fail flux job priority 12345 31
'

test_expect_success 'flux-job: raise fails with bad FLUX_URI' '
! FLUX_URI=/wrong flux job raise ${validjob}
'
Expand Down
10 changes: 10 additions & 0 deletions t/t2210-job-manager-bugs.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,15 @@ test_expect_success 'issue3051: clean up' '
flux queue drain
'

#
# Issue 3218 job-manager: segfault when changing priority of running job
#

test_expect_success 'issue3218: priority change on running job doesnt segfault' '
id=$(flux mini submit sleep 600) &&
flux job wait-event $id start &&
test_must_fail flux job priority $id 0 &&
flux job cancel $id
'

test_done

0 comments on commit 1c231cb

Please sign in to comment.