Skip to content

fix(http): coordinate async stream cancellation and shutdown - #231

Merged
MisterVVP merged 4 commits into
dev-make-libcurl-streaming-cancellation-event-drivenfrom
dev-complete-async-http-streaming-validation
Aug 30, 2026
Merged

MisterVVP merged 4 commits into
dev-make-libcurl-streaming-cancellation-event-drivenfrom
dev-complete-async-http-streaming-validation

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Remove stale persistent "last callback thread" semantics that could cause incorrect Cancel() waits when dispatch workers are reused by replacing it with a scoped RAII callback execution marker.
  • Provide explicit shutdown coordination for the default libcurl-backed async HTTP client so transports reject new streams, cancel active streams, wake/drain the reactor, detach transfers, and wait for dispatched observer work before returning.
  • Authorship: this change set was produced with AI agent assistance and follows repository contribution and documentation requirements.

Description

  • Introduced StreamHandle::State::CallbackExecutionScope (RAII) and replaced execution_thread_id with callback_thread_id, and updated Cancel() to only skip waiting when the same stream's callback is actively running.
  • Added a2a::http::Client::Shutdown() and CurlStreamReactor::Shutdown() plus bookkeeping (active_streams, streams_finished, shutting_down) to reject new streams and wait for active streams to finish; AsyncStreamState marks registration and decrements the active counter on destruction.
  • Added transport-level shutdown hooks and shutdown guards (HttpJsonTransport::Shutdown, JsonRpcTransport::Shutdown, and shutting_down_ flags) so default async clients cannot be used once shutdown begins.
  • Updated streaming documentation to describe scoped callback execution/cancellation semantics, shared reactor behavior, and explicit transport shutdown guarantees.

@MisterVVP MisterVVP added the codex Automatic label added by codex agent. Should not be used label Aug 29, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP self-assigned this Aug 29, 2026
@MisterVVP MisterVVP added AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes. and removed codex Automatic label added by codex agent. Should not be used labels Aug 29, 2026
@MisterVVP
MisterVVP marked this pull request as ready for review August 30, 2026 15:59
@MisterVVP
MisterVVP merged commit 33b9c64 into dev-make-libcurl-streaming-cancellation-event-driven Aug 30, 2026
30 of 32 checks passed
@MisterVVP
MisterVVP deleted the dev-complete-async-http-streaming-validation branch August 30, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant