DefaultAsyncClient never completes the returned future when Client throws Error

Aperta Adatta ai principianti
#3,629 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hutiefang76 ci sta già lavorando.

Dal 19/10/2026.

  • #3630 di @hutiefang76 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
api, backend, testing

Direzione di ricerca

Inizia con DefaultAsyncClient e l’AsyncFeignTest esistente; l’issue descrive la chiamata sincrona del client, il future restituito separatamente e i casi di regressione sia per l’adattatore sia per il percorso pubblico AsyncFeign. Esegui i test riportati con il profilo di sviluppo Maven e conferma che un AssertionError fa sì che il future restituito termini eccezionalmente con l’errore originale, mentre i controlli esistenti per eccezioni e successo continuano a passare.

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

Descrizione

DefaultAsyncClient can leave its returned CompletableFuture pending forever when the synchronous client throws an Error.

The adapter submits a task to an ExecutorService, then completes a separate future inside catch (Exception). An AssertionError bypasses that catch. The executor captures it in its own FutureTask, while the future returned to the caller is never completed. This also hangs a call made through AsyncFeign.

A bounded reproduction on current master e32547ac3afd7386f8427efaaddb97df384596df uses a normal single-thread executor and a client lambda that throws one pre-created AssertionError:

Client client = (request, options) -> { throw failure; };
CompletableFuture<Response> response = new DefaultAsyncClient<Void>(client, executor)
    .execute(request, new Request.Options(), Optional.empty());
response.get(1, TimeUnit.SECONDS);

Expected: an ExecutionException whose cause is the original error, consistent with the AsyncClient completion contract. Actual: TimeoutException.

I added direct-adapter and public AsyncFeign cases to the existing AsyncFeignTest, with IOException, runtime-exception and successful-response controls. The actual run reports 59 tests, 2 failures, 0 errors/skips; both failures are the expected timeout. Each executor is shut down in finally; the cases use no network request or real VM exhaustion.

Verification used the unmodified Maven build with the dev profile, JDK 8 for main sources and JDK 25 for tests. The change can be limited to completing the returned future exceptionally for any throwable from the synchronous client; executor rejection and other async adapters are outside this report. I will send that small fix with these regressions and a changelog entry.

Lingua principale
Java
Stelle
9.8k
Fork
2k
Merge medio
1h 15m
PR unite (30g)
39

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 OpenFeign/feign

Tutte le issue di OpenFeign/feign

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.