--- id: "bug-1728" status: "fixed" status_updated: "2026-09-27" status_note: "33c4f28c: failed join barrier unbinds w->ep (was dangling); idx -1 teardown now WARN" component: "controller" severity: "unknown" timestamp: "2026-08-28T10:25:14Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 3 files: ["src/controller/cluster.c (handle_endpoint_error", "~line 52-77); src/controller/worker.c or join.c (handle_worker_join", "commit-barrier caller -- not yet located)"] tags: ["controller", "ha", "logging-severity", "false-error", "worker-join", "commit-barrier", "found-live", "session-sibling-of-bug-1727"] related: ["bug-1727"] fix_commits: ["33c4f28c"] legacy: true --- # bug-1728: Controller logs `ERROR [handle_endpoint_error] incorrect worker idx -1` in all 3 nodes of a live… ## Description Controller logs `ERROR [handle_endpoint_error] incorrect worker idx -1` in all 3 nodes of a live HA cluster (ctrl-1.log, ctrl-2.log, ctrl-3.log), always immediately after the same two-line sequence: `WARN [commit_submit] commit: WAIT deadline expired without commit (lsn=X committed_lsn=Y writable_lsn=1 timeout_ms=500)` then `WARN [handle_worker_join] handle_worker_join commit barrier failed for pc13v, rc -110`. All three occurrences in the sampled log correlate exactly with an in-progress PreVote/failover window (liveness poll timeout -> primary_ctrl_fd RDHUP -> PreVote begin, immediately preceding each ERROR). ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause NOT FIXED -- recorded for future investigation. Read handle_endpoint_error() (cluster.c:52-119): on any endpoint teardown/error, it inspects priv->role; for HostRole_worker it branches on priv->u.idx -- if >=0, calls handle_worker_leave(c, idx) (the normal, silent teardown path); if <0 (the sentinel for 'never finished joining'), it logs ERROR('incorrect worker idx %d', priv->u.idx) instead (cluster.c:75). Working hypothesis (not yet confirmed by reading handle_worker_join() itself): a worker's endpoint gets `priv->u.idx` assigned only once its join fully completes; the commit barrier inside handle_worker_join() is what actually blocks that completion, and it just failed (rc -110 = -ETIMEDOUT) because quorum was mid-PreVote-failover and couldn't ack the WAL entry within the fixed 500ms commit_submit deadline (already WARNed one line above, correctly). So the worker's join never finishes, its endpoint's idx sentinel never advances off -1, and when that half-joined endpoint then errors out (e.g. the join's own failure path tearing the connection down, or the worker retrying), handle_endpoint_error() sees role==worker && idx==-1 and logs it as a hard, unexplained ERROR -- even though it is the direct, already-WARNed consequence of the commit-barrier timeout two lines above, not a new/distinct fault. Same shape as bug-1727's session sibling finding for scheduler sched_init_resources() and the worker kill-job ERROR-logging issue: an expected, self-healing HA-transition condition (worker retries the join once quorum stabilizes -- confirmed later in the same logs by 'HA quorum restored') surfacing as an unexplained hard ERROR instead of being correlated with the WARN that actually explains it. NOT YET CONFIRMED: have not read handle_worker_join()'s own body (location not pinned down -- likely worker.c or join.c) to verify priv->u.idx really stays -1 specifically because of THIS commit-barrier failure path (vs. some other reason), nor traced exactly what tears the endpoint down afterward to trigger handle_endpoint_error(). ## Fix NOT FIXED -- recorded for future investigation only, no code change made. Next steps: (1) locate and read handle_worker_join()'s full body to confirm priv->u.idx is left at -1 specifically on the commit-barrier-timeout path (rc -110) and identify what closes/errors the endpoint afterward; (2) if confirmed, either (a) downgrade cluster.c:75's ERROR to WARN with a message that explicitly references the join-in-progress/commit-barrier-timeout context (avoids the unexplained-hard-ERROR read), or (b) have the commit-barrier-timeout failure path in handle_worker_join() itself suppress/mark the endpoint so handle_endpoint_error() can recognize 'this was a known, already-logged join failure' and skip the redundant ERROR entirely; (3) verify against a live 3-node HA soak (xce-test-ha) that downgrading doesn't hide a genuinely-different idx<0 cause (e.g. a real accounting bug elsewhere assigning idx incorrectly) -- keep ERROR (or WARN-with-detail) for any idx<-1 or any case NOT immediately preceded by a commit-barrier-timeout WARN for the same worker, so a genuinely new failure mode doesn't get silently swallowed by too broad a downgrade. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1727