fix(controller): set c->running in cluster_run so HA primary streams joblist/workerlist

cluster_start (which set c->running) is orphaned on the HA myapp_run path, so
the running flag was never set on HA nodes — check_controller() treated the
primary as shutting down and zeroed joblist/workerlist reply chunks. Own the
flag lifecycle in cluster_run, symmetric with the c->running=0 on shutdown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-06-16 03:38:55 +00:00
parent a735a880ae
commit 646aa69aa8
3 changed files with 47 additions and 0 deletions

View file

@ -1439,6 +1439,16 @@ int cluster_start(cluster_t* c)
int cluster_run(cluster_t* c)
{
/* c->running is the controller's liveness flag: 1 while the run loop is
* active, 0 once a shutdown request breaks the loop below. check_controller()
* (the streaming gate for joblist/workerlist replies in xce_reply_get) treats
* !running as "shutting down" and zeroes the reply chunk. The legacy
* single-node bring-up set this in cluster_start(), but cluster_start is
* orphaned (not on the HA myapp_run path), so it was never set on HA nodes —
* leaving joblist/workerlist permanently empty on the primary. Own the whole
* flag lifecycle here, symmetric with the `c->running = 0` on shutdown. */
c->running = 1;
for (;;) {
int stop;