apache / apache/shenyu

[BUG] Dubbo ingress parsing throws NPE when endpoints are missing

Open Beginner friendly
#6,484 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

### Current Behavior

`DubboIngressParser` can throw `NullPointerException` when an ingress backend references a service that currently has no `Endpoints` object.

Other parsers such as `DivideIngressParser` check the result of `endpointsLister.namespace(namespace).get(serviceName)` and return an empty upstream list when endpoints are missing. The Dubbo parser does not have that guard:

```java
V1Endpoints v1Endpoints = endpointsLister.namespace(namespace).get(serviceName);
List subsets = v1Endpoints.getSubsets();
```

If Kubernetes has not created endpoints for the referenced service yet, `v1Endpoints` can be `null` and reconciliation fails with NPE.

### Expected Behavior

Dubbo ingress parsing should handle missing endpoints the same way as the divide/websocket parsers: log the missing endpoints and return an empty upstream list, allowing a later reconcile to pick up endpoints when they appear.

### Steps to Reproduce

1. Create a Dubbo ingress that references a service before that service has endpoints.
2. Let the Shenyu Kubernetes controller reconcile the ingress.
3. `DubboIngressParser.parseUpstream()` dereferences `v1Endpoints` and can throw.

### Code Location

- `shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/DubboIngressParser.java`
- `parseUpstream()` reads `v1Endpoints.getSubsets()` without a null check.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/DubboIngressParser.java at parseUpstream(), then compare the missing-endpoints handling in DivideIngressParser and the websocket parser. Reproduce or run the relevant Kubernetes controller parser tests with a service that has no Endpoints object. Done means missing endpoints are logged, parsing returns an empty upstream list, and reconciliation does not fail with an NPE.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kubernetes
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.