12 tests drive the real seqjob plugin through job_alloc_fn and record today's results, reasons and debits, with switch-stable OOM injection (sched_make_allocs stub, --wrap of make_host_alloc/make_job_alloc). Assertions the runner changes on purpose sit in *_today tests. The characterization showed bug-1893's real effect: vget() returns 0 on success, so the shared-reason loop (rc <= 0 skip) never records a shared NO_RESOURCE reason. Bug record and spec wording corrected; the runner skips only on rc < 0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3.9 KiB
| id | status | status_updated | status_note | component | severity | timestamp | last_seen | occurrences | files | tags | related | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bug-1893 | open | 2026-09-30 | newly logged | scheduler | wrong-result | 2026-09-30T03:58:52Z | 2026-09-30T03:58:52Z | 1 |
|
|
|
bug-1893: xce_scheduler allocators never record shared-resource pend reasons (vget rc check inverted)
Description
Observed: found by code reading, so there is no failing run yet. When the shared-resource check fails, both allocators add the pend reasons with
for (i = 0; i < ctx->alloc_req.shared.count; i++) {
rc = vget(core->resmgr, ((int*)ctx->unmeet.idxs.data)[i], (void**)&r);
if (rc <= 0) continue;
add_job_preason(reason->reasons, PREASON_NO_RESOURCE, NULL, r->name);
}
(seqjob_allocator.c my_alloc, parjob_allocator.c my_alloc). The loop
bound is the number of requested shared resources, but ctx->unmeet holds
only the unmet ones, packed at [0, unmeet.count) by unsatisfy_()
(resource.c:152-165). Its arrays were calloced with capacity
shared.count (resource.c:280), so entries [unmeet.count, shared.count)
are 0.
Expected: iterate i < ctx->unmeet.count (as the host path does,
resource.c:566), giving one NO_RESOURCE reason per unmet shared resource.
Impact: wrong pend reason, noise level. When a job requests N shared
resources and only M < N are unmet, the loop adds N - M extra
PREASON_NO_RESOURCE reasons naming whatever resource has index 0 (if one
exists), which that job may never have requested. Main reason and allocation
decision are unaffected. No out-of-bounds memory access (the tail is inside the
allocation).
Found by: review of the scheduler-allocator-runner requirements
(2026-09-29); the loop moves into the framework runner in that spec.
UPDATE (2026-09-30): Found in scheduler-allocator-runner task 2.1 (characterization test test_seqjob_pending_on_short_shared_no_reason_today): the observable effect is not an extra resource-0 reason. vget() (xzarray_get_vec, src/lib/zarray.c) returns 0 on success, and the loop skips on rc <= 0, so it skips every successful lookup and NO shared NO_RESOURCE reason is ever recorded; the over-read tail entries (idx 0) are skipped the same way. Real impact: a job pending on a short shared resource carries no resource reason naming it (main_reason stays 0). The host path (resource.c) correctly skips only rc < 0.
Environment
- OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
- libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2)
- Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
- Build: asan (xce.build)
- Code: scheduler-framework @ a370d724-dirty
- Deployment: n/a: found by code reading; any deployment where a job requests 2+ shared resources and only some are short
Reproduction
git checkout a370d724; read the loop insrc/scheduler/src/plugins/seqjob_allocator.c/parjob_allocator.cmy_alloc()(aftersched_check_shared_satisfy), andsrc/scheduler/src/resource.c:130-169,266-316.- Unit-test sketch: resource idx 0 =
slots; two shared resources A (idx 7, plenty) and B (idx 8, total 0); a seqjob primary requesting 1 of each. Expected: exactly one host-less reason (NO_RESOURCE, res "B"); today a second reason namesslots.
- Frequency: deterministic (by code reading; no test exercises it yet)
- Evidence: not kept (code reading only)
Root cause
TODO: required for fixed/partial
Fix
TODO: required for fixed/partial
Verification
- Test: TODO: name + file; RED before the fix, GREEN after
- Suites: TODO: suite results and build profile
- Live: TODO: soak/deploy run, or n/a and why
References
- Related: none