[Bug]: ActiveTask.start() leaves the event queue dispatchers pending when setup fails
I maintainer di solito rispondono entro 2 giorni
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happened?
ActiveTask (src/a2a/server/agent_execution/active_task.py) creates its two EventQueueSource queues in __init__, and each EventQueueSource starts its dispatcher task as soon as it is created (src/a2a/server/events/event_queue_v2.py):
self._dispatcher_task = asyncio.create_task(self._dispatch_loop())
When the setup in start() fails, the except block marks the task as finished and re-raises, but never closes the queues:
except Exception:
logger.debug('ActiveTask[%s]: Setup failed, cleaning up', self._task_id)
self._is_finished.set()
if self._reference_count == 0 and self._on_cleanup:
self._on_cleanup(self)
raise # _event_queue_agent and _event_queue_subscribers stay open
The setup fails when the stored task is in a terminal state (UnsupportedOperationError) or is missing and create_task_if_missing is false (TaskNotFoundError). With DefaultRequestHandler, a SendMessage to a completed task takes the first path, so each rejected request leaves two _dispatch_loop tasks pending. Once they are garbage collected, asyncio logs:
Task was destroyed but it is pending!
task: <Task pending name='Task-28' coro=<EventQueueSource._dispatch_loop() ...>>
On a server built with DefaultRequestHandler, InMemoryTaskStore and the JSON-RPC and REST routes, six SendMessage requests to completed tasks log this twelve times.
Suggested fix: close both queues in the except block, before _on_cleanup:
await self._event_queue_agent.close(immediate=True)
await self._event_queue_subscribers.close(immediate=True)
aclose() already closes the queues the same way, but it can't be called here because it takes _lock, which start() holds.
I have a fix ready and I'm opening a PR alongside this issue.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 532
- Merge medio
- 3g 6h
- PR unite (30g)
- 42
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-python
-
[Bug]: `A2A-Version` validation ignores minor versions and the query parameterForse già presa @rohityan l’ha presa 72 giorni fa. Apertacomponent: server status:awaiting response status:stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
a2aproject/a2a-python#1204 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: REST task/request id sanitizationForse già presa @Linux2010 l’ha presa 130 giorni fa. Apertamaintainers-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-python#805 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: v0.3 REST client raises NotImplementedError for list_task_push_notification_configsForse già presa @RaphaelFakhri l’ha presa 1 giorno fa. Apertacomponent: client status:awaiting response
a2aproject/a2a-python#1423 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Compat REST client drops security from the v0.3 extended agent cardForse già presa @ConnorMoss02 l’ha presa 1 giorno fa. Apertacomponent: client status:awaiting response
a2aproject/a2a-python#1418 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
v0.3 JSON-RPC returns -32600 instead of -32602 for invalid paramsForse già presa @ConnorMoss02 l’ha presa 2 giorni fa. Apertacomponent: server status:awaiting response
a2aproject/a2a-python#1417 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di a2aproject/a2a-python
Issue simili
-
docs: Release playbookApertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
I maintainer di solito rispondono entro 1 giorno
-
subtask
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
txn2/mcp-data-platform#2493 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
YO-WHATS-UP2/minigit#78 ·
I maintainer di solito rispondono entro 3 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
liberation-data/drivine-python#432 ·
I maintainer di solito rispondono entro 1 giorno