forked from lei.chen/myxce
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 <noreply@anthropic.com>
This commit is contained in:
parent
a9e6446b1e
commit
5657fca7f7
1 changed files with 11 additions and 0 deletions
|
|
@ -147,6 +147,17 @@ static int xcesched_push_configs(cluster_t* c)
|
||||||
|
|
||||||
memset(&configdata, 0x0, sizeof(configdata));
|
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
|
configdata.data.conf4sched
|
||||||
= (xce_conf4sched_t*)calloc(1, sizeof(xce_conf4sched_t));
|
= (xce_conf4sched_t*)calloc(1, sizeof(xce_conf4sched_t));
|
||||||
if (configdata.data.conf4sched == NULL) {
|
if (configdata.data.conf4sched == NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue