fix(libxce-failover): correct endpoint reconnect on rotate — re-bind iomgr + re-arm handlers (fixes endpoint_connect SEGV during live failover)

xce_failover_rotate reconnected with endpoint_fini+endpoint_init+endpoint_connect
but never re-bound ep->iomgr (reset by endpoint_init) nor re-armed the owner/
msg/err handlers + iomgr_monitor. endpoint_connect then dereferenced a NULL
iomgr (->ssl_ctx) → SEGV at netio.c:672 during live master failover. Added
xce_ctx_reconnect() in xcectx.c that mirrors xcecli_start's establishment
(without restarting iomgr/vtaskmgr or touching ctx->state); rotate delegates to
it. Found via live 3-node E2E. bug-610.
This commit is contained in:
Rongsong Shen 2026-06-17 06:53:46 +00:00
parent 312bd6be34
commit ffc2c590f9
4 changed files with 95 additions and 18 deletions

View file

@ -56,6 +56,7 @@ extern int xce_ctx_stop(xce_ctx_t*);
extern int xce_wakeup(xce_ctx_t*, int);
extern int xce_try_wakeup(xce_ctx_t*, int);
extern int xce_ctx_set_endpoint(xce_ctx_t*, endpoint_t*);
extern int xce_ctx_reconnect(xce_ctx_t*, char*, int);
extern void xce_block_tasks(xce_ctx_t*);
extern void xce_unblock_tasks(xce_ctx_t*);