[Bug]: Blocking message/send loses the final event when the agent emits an event before completing
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Start in MainQueue's distributeToChildren, where the child.isClosed() skip drops the final event, and read how ChildQueue tracks isAwaitingFinalEvent() alongside MainEventBusProcessor and EventConsumer's polling loop. Reproduce with a DefaultRequestHandlerTest case that blocks the WORKING event until the handler closes the queue. Done when the blocking message/send returns the completed task promptly and the server-common tests pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happened?
Since 1.4.0.Final, a blocking message/send (returnImmediately false) to an agent that emits an event
before its terminal one, for example startWork() followed by complete(), returns about 3 seconds late.
With the timeouts of DefaultRequestHandler.builder() (2 s consumption timeout) it fails instead with
"InternalError: Timeout waiting for task consumption".
The sequence:
- The agent calls complete(). MainQueue marks the caller's ChildQueue as expecting a final event
(expectFinalEvent / submitExpectedFinalEvent) and submits the event to the MainEventBus. - ResultAggregator already returned to onMessageSend on the first event (WORKING). The agent returns,
and step 2 of the blocking handling closes the child queue with queue.close(false, false). - MainEventBusProcessor persists the final event and calls distributeToChildren, which skips the child
because child.isClosed() is true, although the child is still awaiting that event. - EventConsumer keeps polling while isAwaitingFinalEvent() is true, until MAX_AWAITING_FINAL_TIMEOUT_MS
(3 s) runs out. Only then does step 3 complete.
This is a regression in 1.4.0.Final. The skip in distributeToChildren came in with dabca6c
("fix(server): recover failed terminal enqueues and fix EventQueue close races"); 1.3.2.Final delivers to
every child, and the same test passes there. The comment above the skip says a final event cannot be in
flight for a closed child, because closeIfNotAwaitingFinalEvent() prevents that. Step 2 in
DefaultRequestHandler closes with close(false, false), which does not look at those counters.
Expected: the blocking call returns the completed task as soon as the final event is persisted.
To reproduce: a test in DefaultRequestHandlerTest that holds the agent's next event in the event bus
(a MainEventBusProcessorCallback that blocks on the WORKING event) until the agent has returned and the
handler has closed the queue. It passes on 1.3.2.Final and fails on 1.4.0.Final; main has the same code
as 1.4.0.Final.
A possible fix, which makes the test pass with all server-common tests green:
if (child.isClosed() && !child.isAwaitingFinalEvent()) {
A gracefully closed child still drains its queue, so delivering the final event it was told to expect
lets the consumer finish at once. I can open a PR with the test and this change.
Relevant log output
DefaultRequestHandler: Step 2 - Closed queue for task b6db44c8-... to allow consumption completion
MainQueue[b6db44c8-...]: Skipping closed child queue for event TaskStatusUpdateEvent
Agent completed, awaiting final event (timeout 1/6), continuing to poll (queue=16373883)
Agent completed, awaiting final event (timeout 2/6), continuing to poll (queue=16373883)
Agent completed, awaiting final event (timeout 3/6), continuing to poll (queue=16373883)
Timeout waiting for task b6db44c8-... consumption
- Langage dominant
- Java
- Étoiles
- 510
- Forks
- 196
- Merge moyen
- 2 j 22 h
- PR mergées (30 j)
- 31
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de a2aproject/a2a-java
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
a2aproject/a2a-java#1275 ·
Les mainteneurs répondent en général sous 1 jour
-
fix: handle blank push notification config id consistently across transportsPeut-être pris @prachisinghal-1 l’a pris il y a 11 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
a2aproject/a2a-java#1012 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
a2aproject/a2a-java#464 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksPeut-être à nouveau libre @tanish111 l’a pris il y a 378 jours, et aucune pull request n’est ouverte. Ouvertesample
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
a2aproject/a2a-java#375 · 5 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: ListTasksResult rejects valid responses when pageSize ≠ number of returned tasks (InvalidParamsError)Peut-être pris @RaphaelFakhri l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 25/100
a2aproject/a2a-java#1260 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de a2aproject/a2a-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Dans-Plugins/Medieval-Roleplay-Engine#396 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
LtByXsl throws NoSuchElementException when defect element has no text contentPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
objectionary/lints#1640 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
virtualcell/vcell#2193 ·
Les mainteneurs répondent en général sous 1 jour