xds: duplicate endpoint addresses across localities are ACKed and can panic outlier detection
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- Ein halber Tag
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- java
- Bereich
- distributed-systems
Rechercherichtung
Start in xds/src/main/java/io/grpc/xds/XdsEndpointResource.java, where the ClusterLoadAssignment locality entries are parsed into an EdsUpdate, and check every endpoint address across all localities and priorities before the update is returned. Throw ResourceInvalidException on a duplicate IP:port so the existing NACK and last-good-resource path handles it. Done when the attached eds-invalid.json is NACKed, eds-valid.json still ACKs, and the same IP with a different port is still accepted.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What version of gRPC-Java are you using?
1.71.0 and 1.83.1. Both accept the invalid EDS resource described below. The outlier-detection scenario reproduces a NullPointerException/Panic on both versions.
What is your environment?
Reproduced in a local integration test on macOS 26.2 arm64, JDK 26.0.1 (Java 17 target), using grpc-netty, grpc-xds, a local ADS server and a unary gRPC backend. The control plane uses SotW ADS v3 and the cluster uses EDS, LEAST_REQUEST and outlier detection.
What did you expect to see?
NACK the ClusterLoadAssignment containing the same endpoint IP:port in different localities. Retain the last accepted configuration and accepted version_info, keep serving RPCs, and continue processing subsequent EDS updates. On a cold start with invalid EDS, do not route RPCs until a valid configuration arrives.
This is the behavior verified with grpc-go 1.83.2.
What did you see instead?
grpc-java ACKs the invalid resource. If the endpoint is already ejected by outlier detection, adding the second locality can trigger a NullPointerException in OutlierDetectionLoadBalancer.OutlierDetectionSubchannel.eject because subchannelStateListener is null. The ManagedChannel enters INTERNAL: Panic! This is a bug!
The attached stack is from grpc-java 1.83.1. This is not the duplicate-locality-within-one-priority case fixed by https://github.com/grpc/grpc-java/pull/9119: the locality IDs here are different; the endpoint socket address is the same.
Steps to reproduce the bug
- Start a local unary gRPC backend on 127.0.0.1:1234 and an ADS server serving LDS/CDS/EDS for an EDS cluster with LEAST_REQUEST and outlier detection.
- Publish eds-valid.json as version 1 and wait for its ACK and successful RPCs.
- Make the backend return UNAVAILABLE until outlier detection ejects it; then make it healthy again. The test uses interval=0.1s, baseEjectionTime=2s, maxEjectionTime=2s, maxEjectionPercent=100, enforcingSuccessRate=0, enforcingFailurePercentage=100, failurePercentageThreshold=30, failurePercentageMinimumHosts=1 and failurePercentageRequestVolume=1.
- While the endpoint is still ejected, publish eds-invalid.json as version 2. Observe ACK instead of NACK and the NPE/Panic stack.
- Repeat invalid EDS updates, then roll back to valid EDS. The invalid configuration should never have reached the load balancer or poisoned the channel.
The simpler validation failure does not require backend failures or outlier detection: publish eds-invalid.json after a healthy version 1 and observe ACK instead of NACK. Publishing invalid EDS on cold start also incorrectly permits successful RPCs.
Potential fix
Validate uniqueness of endpoint addresses while parsing all original ClusterLoadAssignment locality entries, before exposing an EdsUpdate to load balancing. Do not validate only the locality-keyed output map: repeated locality IDs in different priorities can overwrite entries in that map. Throw ResourceInvalidException for duplicate IP:port, using the normal NACK/last-good-resource path. The same IP with a different port must remain valid.
Relevant implementation
https://github.com/grpc/grpc-java/blob/v1.83.1/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java
https://github.com/grpc/grpc-go/blob/v1.83.2/internal/xds/xdsclient/xdsresource/unmarshal_eds.go
- Vorherrschende Sprache
- Java
- Sterne
- 12.1k
- Forks
- 4k
- Ø Merge
- 2 T. 9 Std.
- Gemergte PRs (30 T.)
- 44
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus grpc/grpc-java
-
channelz: ServerData `calls_failed` counter not incremented upon client cancellationEvtl. vergeben @JoeCqupt hat das vor 5 Tagen übernommen. Offenenhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
grpc/grpc-java#13063 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
grpc/grpc-java#10824 · 8 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
grpc/grpc-java#13137 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
question
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
Maintainer antworten meist innerhalb von 1 Tag
-
binder: `ServerStream.close()` marks the stream closed before the suffix is sent, so a flow-control-deferred send failure leaks the callEvtl. vergeben @kkmurthyt21 hat das vor 7 Tagen übernommen. Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
grpc/grpc-java#13097 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
hiero-ledger/hiero-sdk-java#3010 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Optimize consumer version heatmap aggregation to avoid repeated scansEvtl. vergeben @praykaria31 hat das heute übernommen. Offentype/enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Apicurio/apicurio-registry#10662 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
a:false-positive
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
Maintainer antworten meist innerhalb von 1 Tag
-
status: waiting-for-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
spring-projects/spring-boot#52347 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
opensearch-project/opensearch-migrations#3480 ·
Maintainer antworten meist innerhalb von 2 Tagen