fix(lib): reconnect from an endpoint's own task neither waits nor leaks old replies (bug-1917)
A reconnect made from inside a task of the endpoint it re-establishes (a request handler that failed over) waited out the full 2 s quiesce bound: its own reference cannot drain, and the old connection's queued tasks are serialised behind it -- and those then ran after the owner was re-armed, reaching the new session. Each VTASK_IO task now records the endpoint's reconnect_gen when queued and vtask_entry drops a task whose generation is stale; the vtask manager tracks the endpoint whose task the current thread runs (vtask_current_io_ep), and xce_ctx_quiesce_ep skips the wait in that case. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6a42631b2a
commit
f26a2d4586
5 changed files with 122 additions and 0 deletions
|
|
@ -170,6 +170,10 @@ typedef struct endpoint_t {
|
|||
typedef struct {
|
||||
endpoint_t* ep;
|
||||
io_packet_t* pkt;
|
||||
/* ep->reconnect_gen when the message was received (bug-1917): a task of
|
||||
* a connection that has since been re-established is stale and is
|
||||
* dropped instead of being delivered to the new session. */
|
||||
uint64_t gen;
|
||||
} io_task_data_t;
|
||||
|
||||
extern int alloc_packet(io_packet_t*);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ extern int vtask_enq(vtaskmgr_t*, vtask_t*);
|
|||
extern vtask_t* vtask_deq_eligible(dataq_t* taskq,
|
||||
int (*is_blocked)(endpoint_t*));
|
||||
extern int vtask_handle_msg(vtaskmgr_t*, vtask_func_t, void* arg);
|
||||
/* bug-1917: the endpoint whose VTASK_IO task the calling thread is running,
|
||||
* or NULL when it is not running one. */
|
||||
extern endpoint_t* vtask_current_io_ep(void);
|
||||
|
||||
/* LivenessAdmission (raft-drive-async task 1.6) — pool-level reservation.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue