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

Flaky CI in `pkg/eventstreams`: webhook retry loop races test teardown (connection refused on localhost)

Aperta
#236 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Inizia in pkg/eventstreams eseguendo i relativi test con il race detector e analizzando l’esecuzione CI fallita di PR #234. Traccia Stop(), i worker di retry del webhook e i test flaky per verificare la cancellazione e il completamento dei worker prima dell’arresto del mock server. Il lavoro è completato quando i test del package passano in modo deterministico, con i worker arrestati prima del teardown e senza asserzioni sui retry sensibili al timing.

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

Descrizione

Summary

The Go CI job is intermittently failing in github.com/hyperledger-firefly/common/pkg/eventstreams due to a teardown race between webhook retry goroutines and test HTTP server shutdown.

Symptoms from logs

Repeated retry attempts continue dispatching PUT requests to a localhost mock endpoint after it is no longer accepting connections:

  • Put "http://127.0.0.1:45445/some/path": dial tcp 127.0.0.1:45445: connect: connection refused
  • Batch attempt N failed. err=FF00219: Webhook request failed ...
  • Stream lifecycle churn appears concurrently (stopped, stopping, deleted, No in-memory state for stream ...)

The overall run fails with:

  • FAIL github.com/hyperledger-firefly/common/pkg/eventstreams
  • make: *** [Makefile:15: test] Error 1

Expected behavior

Event stream tests should deterministically stop all dispatch/retry workers before teardown of test infrastructure (e.g., mock HTTP servers), so CI is stable.

Proposed fix

  1. Ensure stream stop is synchronous for tests (or provide a blocking test helper):
  • cancel stream context
  • wait for all worker goroutines to exit (WaitGroup)
  1. In tests, stop stream before server shutdown:
  • require.NoError(t, es.Stop()) before srv.Close() / test exit
  1. Use deterministic retry config in tests:
  • low max attempts (1–2)
  • short backoff
  1. Assert on terminal error/state rather than timing-sensitive retry log counts.

Suggested implementation direction

  • If Stop() is currently non-blocking, make it block until all dispatch/retry loops terminate.
  • Ensure every worker loop exits on ctx.Done() and decrements WaitGroup.
  • Update flaky tests in pkg/eventstreams to enforce stop-before-close ordering.

Notes

This appears to be test flakiness/race behavior, not a product logic regression.

Lingua principale
Go
Stelle
5
Fork
15
Merge medio
3g 9h
PR unite (30g)
3

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 hyperledger-firefly/common

Tutte le issue di hyperledger-firefly/common

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.