From 5657fca7f7bf4dbe8a1f198bc87f6c17126cb2bb Mon Sep 17 00:00:00 2001 From: "lei.chen" Date: Tue, 11 Aug 2026 03:19:02 +0000 Subject: [PATCH] fix(controller): guard config push against NULL cluster_config on cold boot Merge the scheduler-join NULL guard from the remote js branch: if the controller's cluster config is not loaded yet (cold boot / config not pushed yet), xcesched_push_configs would dereference a NULL cluster_config and crash the controller (ASan SEGV on scheduler join). Skip the push; the scheduler receives config on a later join once config is available. Co-Authored-By: Claude --- src/controller/sched.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/controller/sched.c b/src/controller/sched.c index 13f50ac..ac0b27f 100644 --- a/src/controller/sched.c +++ b/src/controller/sched.c @@ -147,6 +147,17 @@ static int xcesched_push_configs(cluster_t* c) memset(&configdata, 0x0, sizeof(configdata)); + if (c->myconf == NULL || c->myconf->cluster_config == NULL) { + /* No cluster config loaded yet (cold boot / config not pushed yet). + * Pushing configs now would dereference a NULL cluster_config and + * crash the controller (ASan SEGV on scheduler join). Skip; the + * scheduler will receive config on a later join once config is + * available. */ + WARN("%s: cluster_config not loaded yet, skipping config push", + __func__); + return 0; + } + configdata.data.conf4sched = (xce_conf4sched_t*)calloc(1, sizeof(xce_conf4sched_t)); if (configdata.data.conf4sched == NULL) {