fix(lib): quiesce the old endpoint before xce_ctx_reconnect re-inits it (bug-1917)

Work dispatched for the old connection (the io_worker's epoll batch,
queued VTASK_IO reply tasks) could still run while the reconnect tore
down and re-armed ctx->ep; a queued reply of the old connection then
reached the new session. The reconnect now unmonitors the old fd,
clears ep->owner (stale tasks are dropped) and waits for the endpoint's
references to drain, bounded at 2 s so a caller that is itself one of
those tasks cannot deadlock. vtask_entry reads ep->owner under ep->lock.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-04 23:59:29 +00:00
parent a74b684c48
commit 431a6d709e
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
4 changed files with 186 additions and 0 deletions

View file

@ -230,6 +230,7 @@ libxce_test_src = ['testsuite/test.c',
'testsuite/test_vtask_admission.c',
'testsuite/test_vtask_enq_race.c',
'testsuite/test_vtask_pkt_handoff.c',
'testsuite/test_ctx_reconnect_quiesce.c',
'testsuite/test_vtask_order.c',
'testsuite/test_vtaskmgr_teardown.c',
'testsuite/test_xcealloc.c',