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

HealthCheckServiceInstanceListSupplier docs say all instances are returned when none are healthy, but code returns an empty list

Chiusa
#1,771 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #1772 di @bhosale-mahesh — integrata
  • #1773 di @bhosale-mahesh — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, spring, spring-boot

Direzione di ricerca

Start by reading HealthCheckServiceInstanceListSupplier.java around the Flux.merge result handling and comparing the behavior with the reference documentation. Check HealthCheckServiceInstanceListSupplierTests.java, especially shouldEmitAllInstancesIfAllIsAliveChecksFailed, to understand the currently asserted empty-list behavior. Before changing anything, determine from project discussion whether the intended fix is documentation, Javadoc, the test name, or the implementation; done means the documented, tested, and implemented behavior agree.

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

Descrizione

documentation

Summary

The docs, javadoc and one test name say HealthCheckServiceInstanceListSupplier returns all instances when none are healthy. Code and test assertions return an empty list. Checked on v5.0.3 and main.

What the docs say

Instance Health-Check for LoadBalancer:

It regularly verifies if the instances provided by a delegate ServiceInstanceListSupplier are still alive and only returns the healthy instances, unless there are none - then it returns all the retrieved instances.

Class javadoc says "...only returns the healthy one, unless there are none."

What the code does

When all checks fail, Flux.merge(checks) emits nothing. Both paths then produce an empty list:

HealthCheckServiceInstanceListSupplier.java lines for the result / defaultIfEmpty(result) / collectList() block

List<ServiceInstance> result = new ArrayList<>();
if (healthCheck.isUpdateResultsList()) {
	return Flux.merge(checks).map(alive -> {
		result.add(alive);
		return result;
	}).defaultIfEmpty(result);   // result is empty
}
return Flux.merge(checks).collectList();   // empty list

What the tests assert

shouldEmitAllInstancesIfAllIsAliveChecksFailed: the name says "all", the assertion expects an empty list.

HealthCheckServiceInstanceListSupplierTests.java lines for that test

.expectNext(Lists.list())

shouldRepeatIsAliveChecksIndefinitely and shouldTimeoutIsAliveCheck also expect [] in the first round.

Question

Which one is intended?

  • Docs are wrong: Will create PR for fix in docs, javadoc and the test name.
  • Code is wrong: Will create PR returns all instances when none are healthy, with tests.
Lingua principale
Java
Stelle
750
Fork
749
Merge medio
17h 13m
PR unite (30g)
23

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 spring-cloud/spring-cloud-commons

Tutte le issue di spring-cloud/spring-cloud-commons

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.