Keep app-server thread RPCs active until delegated work completes (#43950)

## Why

Thread startup, running-thread resume, and rollback could outlive their request handlers, allowing connection draining and request serialization to finish too early.

## What changed

- Await thread startup and listener completion for running-thread resume and rollback.
- Release the thread-list permit before waiting for resume completion so the listener can finish rollback responses.
- Release pending rollback waiters when clearing a listener, and discard queued requests when their connection closes.

## Testing

Add coverage for releasing queued requests and rollback waiters, and pipeline resume during rollback to check that both responses complete. Update diagnostics expectations to allow startup to remain in flight after its response is queued.

GitOrigin-RevId: 138156179afbc40de29965820db7fa9cd3669cc7
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-09 00:25:02 +00:00
1 parent 589874be81
commit 102e1763b9
8 files changed
+134 -42

No files matched your search

@@ -1245,7 +1245,7 @@ pub(crate) async fn apply_bespoke_event_handling(
state.pending_rollbacks.take()
};
if let Some(request_id) = pending {
if let Some((request_id, _completion_tx)) = pending {
let _thread_list_state_permit = match thread_list_state_permit.acquire().await {
Ok(permit) => permit,
Err(err) => {
@@ -1643,7 +1643,7 @@ async fn handle_thread_rollback_failed(
) {
let pending_rollback = thread_state.lock().await.pending_rollbacks.take();
if let Some(request_id) = pending_rollback {
if let Some((request_id, _completion_tx)) = pending_rollback {
outgoing
.send_error(request_id, invalid_request(message))
.await;