Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Fix duplicate terminal callbacks in SSE listeners

Chiusa
#1,170 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Examine the JSON-RPC SSE listeners in the codebase, focusing on the completed flag and terminal callbacks. Look for the native JSON-RPC listener and the 0.3 compatibility JSON-RPC listener to understand their lifecycle patterns. Start by reviewing the relevant classes, then implement an atomic state transition (e.g., using AtomicBoolean.compareAndSet) to ensure exactly one terminal callback is delivered. Test with concurrent scenarios to verify the fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

The JSON-RPC SSE listeners use a volatile completed flag with non-atomic check-and-set behavior. onComplete(), onError(), parsing failures, and final-event cancellation can race or occur in close succession, allowing the error consumer to be invoked more than once (including a null completion signal after an error/cancellation).

The native JSON-RPC listener has the same lifecycle pattern, and the 0.3 compatibility JSON-RPC listener mirrors it. This should be addressed consistently, rather than patched only in the compatibility adapter.

Expected behavior

For one streaming request, deliver exactly one terminal callback to the error/completion consumer: either one non-null failure or one null normal-completion signal. A final task/status event that cancels the stream must not allow a later terminal callback to duplicate or contradict that outcome.

Suggested direction

Define the terminal-state contract for the native JSON-RPC and 0.3 JSON-RPC SSE listeners, then guard every terminal path with one shared atomic transition (for example, AtomicBoolean.compareAndSet(false, true)). Cover concurrent or repeated completion/error notifications and cancellation after a final event. Evaluate REST separately: its native and 0.3 implementations currently both use a no-op completion callback, so changing that is an API decision rather than a compat-only fix.

Lingua principale
Java
Stelle
505
Fork
185
Merge medio
1g 9h
PR unite (30g)
26

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di a2aproject/a2a-java

Tutte le issue di a2aproject/a2a-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.