fix(server): fix deadlocks on agent execution failure in non-streaming by lbobinski · Pull Request #614 · a2aproject/a2a-python · GitHub
Skip to content

fix(server): fix deadlocks on agent execution failure in non-streaming - #614

Merged
ishymko merged 14 commits into
a2aproject:mainfrom
lbobinski:fix/gh-609
Feb 12, 2026
Merged

ishymko merged 14 commits into
a2aproject:mainfrom
lbobinski:fix/gh-609

Conversation

@lbobinski

@lbobinski lbobinski commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses potential deadlocks and resource leaks in the DefaultRequestHandler when agent execution fails, particularly in non-streaming scenarios.

Fixes #609 🦕

@lbobinski
lbobinski requested a review from a team as a code owner January 9, 2026 13:44
@gemini-code-assist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses potential deadlocks and resource leaks by ensuring that producer tasks and their associated queues are properly cleaned up when an agent execution fails, especially in streaming and non-blocking scenarios. The changes in on_message_send and on_message_send_stream correctly cancel the producer and close the queue on consumer failure. The modification in _cleanup_producer is also crucial for ensuring cleanup logic runs reliably. I have one suggestion to improve logging in the cleanup path to avoid silently swallowing exceptions.

Comment thread src/a2a/server/request_handlers/default_request_handler.py Outdated
@holtskinner holtskinner changed the title fix: resolve deadlocks on agent execution failure #609 fix(server): resolve deadlocks on agent execution failure #609 Jan 9, 2026
@ishymko ishymko changed the title fix(server): resolve deadlocks on agent execution failure #609 fix(server): fix deadlocks on agent execution failure in non-streaming Feb 12, 2026
@ishymko
ishymko merged commit d3c973f into a2aproject:main Feb 12, 2026
10 checks passed
ishymko pushed a commit that referenced this pull request Feb 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.23](v0.3.22...v0.3.23)
(2026-02-13)


### Features

* add async context manager support to BaseClient
([#688](#688))
([ae9dc88](ae9dc88))
* add async context manager support to ClientTransport
([#682](#682))
([2e45c0d](2e45c0d))
* support async card modifiers
([#654](#654))
([a802500](a802500))
* support disabling OTel instrumentation via env var
([#611](#611))
([72216b9](72216b9))


### Bug Fixes

* do not crash on SSE comment line
([#636](#636))
([3dcb847](3dcb847))
* gRPC metadata header casing and invocation_metadata() call
([#676](#676))
([390b763](390b763))
* Improve error handling for Timeout exceptions on REST and JSON-RPC
clients ([#690](#690))
([2acd838](2acd838))
* map rejected task state in proto converters
([#668](#668))
([957e92b](957e92b)),
closes [#625](#625)
* **server:** fix deadlocks on agent execution failure in non-streaming
([#614](#614))
([d3c973f](d3c973f))


### Documentation

* explicitly mention supported spec version and transports in readme
([#681](#681))
([c91d4fb](c91d4fb)),
closes [#677](#677)
* Update README to include Code Wiki badge
([2698cc0](2698cc0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
lithammer added a commit to lithammer/kagent that referenced this pull request Feb 18, 2026
The main motivation is that it includes this fix:

- a2aproject/a2a-python#614

It's described in more detail from a kagent perspective here:

- kagent-dev#1268

Signed-off-by: Peter Lithammer <peter.lithammer@embark-studios.com>
EItanya pushed a commit to kagent-dev/kagent that referenced this pull request Feb 18, 2026
The main motivation is that it includes this fix:

- a2aproject/a2a-python#614

It's described in more detail from a kagent perspective here:

- #1268

Signed-off-by: Peter Lithammer <peter.lithammer@embark-studios.com>
Raghavendiran-2002 pushed a commit to Raghavendiran-2002/kagent that referenced this pull request Apr 30, 2026
The main motivation is that it includes this fix:

- a2aproject/a2a-python#614

It's described in more detail from a kagent perspective here:

- kagent-dev#1268

Signed-off-by: Peter Lithammer <peter.lithammer@embark-studios.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DefaultRequestHandler hangs on_message_send for consumer failures

3 participants