--- id: "bug-1572" status: "fixed" status_updated: "2026-09-24" status_note: "c9acd502 (bug-1585)" component: "scheduler" severity: "crash" timestamp: "2026-08-18T01:30:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/scheduler/src/driver.c", "src/scheduler/src/core_events.c"] tags: ["scheduler", "core_events.c", "driver.c", "double-free", "dangling-pointer", "resvals-delta", "crash", "resource-value-verification", "task-4.1", "pre-existing", "unresolved"] related: [] fix_commits: ["c9acd502"] legacy: true --- # bug-1572: xce_scheduler silently exits (no ASAN report captured -- backgrounded via setsid nohup ...… ## Description xce_scheduler silently exits (no ASAN report captured -- backgrounded via setsid nohup ... >/dev/null 2>&1) a few seconds after a worker's SECOND periodic resource_sync report for the same resource(s); first report processes fine, second triggers the crash with zero "resval applied" TRACE lines logged for that batch and "handle_scheduler_leave" observed on the controller ~1s later. ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause Discovered live during resource-value-verification task 4.1 round-2 remediation smoke test (unrelated to the fix being validated -- reproduces identically with round-1's code, since round-1 only added a TRACE line AFTER the same zarray_put call). xce_core_push_events()'s XCE_CORE_EVENT_RESVALS_DELTA case (core_events.c ~line 786) does `zarray_put(&(w->resvals), res->idx, rv->val)` -- storing the decoded delta's xce_val_t* pointer DIRECTLY into scheduler-owned state, WITHOUT a MOVE_PTR/copy (unlike core_apply_config_resvals()'s sibling handling of the same ambiguity, which explicitly does `MOVE_PTR(val, nv->val); zarray_put(&(core->sharedInst), r->idx, val);`). Meanwhile driver.c's release_translated_payload() (called at driver.c:586 with applied=(push_rc>=0) after every successfully-pushed batch) has a case XCE_SCHED_OP_UPDATE_RESVALS: `free_ResValList_ptr(&(req->u.resvalupdate.resvals))` with NO `if (!applied)` guard -- unlike the sibling XCE_SCHED_OP_UPDATE_CONFIG case, which explicitly skips the free when applied ("core->config now owns it permanently -- do not free"). Net effect: every successfully-applied RESVALS_DELTA batch immediately frees the exact xce_val_t objects that were just aliased into w->resvals[idx], leaving a dangling pointer there. The dangling pointer is inert until the SAME (worker, resource) index is updated again -- at that point zarray_put's killer (kill_sched_resval -> free_Value) is invoked on the already-freed pointer, a double-free that aborts the ASAN-instrumented process. This is why it manifests specifically on a worker's second periodic report, not the first. ## Fix NOT FIXED -- out of scope for resource-value-verification task 4.1 round-2 remediation, whose boundary was explicitly restricted to src/scheduler/src/core_events.c's Value_u_which else-branch bug only. Needs its own task: either (a) MOVE_PTR the value out of rv before zarray_put in core_events.c's RESVALS_DELTA case (mirroring core_apply_config_resvals()'s existing pattern) so release_translated_payload()'s free no longer touches live scheduler state, or (b) add an `if (!applied)` guard to driver.c's XCE_SCHED_OP_UPDATE_RESVALS case (mirroring XCE_SCHED_OP_UPDATE_CONFIG) so a successfully-applied batch is never freed at all -- (a) is likely preferable since RESVALS_FULL's sibling case has the identical unguarded-free shape and should be audited too. Worked around during round-2 validation by running the smoke test's resupdate quickly after deploy, before any real worker's second periodic report could trigger the crash. ## Verification _Not recorded (migrated from buglog.json)._ ## References _Not recorded (migrated from buglog.json)._