fix(scheduler): never elect a job without a schedobj (bug-1897)

A job whose snapshot resreq fails to parse (any replay captured before
the bug-1888 fix) is kept by xce_sched_core_load_snapshot() with no
schedobj, but was still made a picker candidate -- by the loader and, in
simulation mode, by sim_bootstrap_picker()'s picker rebuild. The
allocator thread then dereferenced the NULL schedobj in
limit_job_election() and xce_scheduler --sim crashed.

Both push sites now skip such a job (it stays in the core so a restored
allocation is still charged), and sched_allocator() skips any picked job
without a schedobj as a backstop.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-01 03:45:51 +00:00
parent 3d3f37e0fd
commit 0fe27d4be3
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 239 additions and 15 deletions

View file

@ -2216,6 +2216,27 @@ test('scheduler election sim fixture test',
sched_election_sim_fixture_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# bug-1897: sched_allocator() must skip a picked job whose schedobj is NULL
# (resreq failed to parse on snapshot load) instead of dereferencing it.
# Same real-scheduler_srcs link technique as the fixture test above.
sched_election_null_schedobj_test_srcs = ['test_sched_election_null_schedobj.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_election_null_schedobj_test_srcs += ['../' + f]
endif
endforeach
sched_election_null_schedobj_test = executable(
'sched_election_null_schedobj_test',
sched_election_null_schedobj_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
test('scheduler election null schedobj test',
sched_election_null_schedobj_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-live-allocation spec, task 4.1 (Req 1.1, 1.2, 3.3, 4.2, 4.3,
# 5.1, boundary: Unified Picker/Allocator Threads, Sim Driver): proves
# sched_sim_driver_run() (sim_loop.c) itself -- not just the relocated