apache / apache/dubbo

[Bug] The traffic will be routed to instances of previous interface, which causes no such method error

Open
#16,131 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

### Pre-check

- [x] I am sure that all the content I provide is in English.

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.

### Apache Dubbo Component

Java SDK (apache/dubbo)

### Dubbo Version

Dubbo 3.3.6, JDK 1.8

### Steps to reproduce this issue

Prepare two interfaces in different application, and invoke the interfaces one by one. The invocation of second interface will have no such method error.

### What you expected to happen

The traffic should be always go to correct instances.

### Anything else

After debugging, the issue is at the lines below in `AbstractDirectory`
```
/**
* All invokers from registry
*/
private volatile BitList> invokers = BitList.emptyList();
```

The invokes are initiated by `BitList.emptyList()`, and the `emptyList()` returns a variable of empty list. However, the `invokers` variable get the reference of `emptyList`, and changes happens in the first invocation of the first interface. When the second interface is invoked, the invokes are not empty, but the instances of the previous instances of the first interface.

### Do you have a (mini) reproduction demo?

- [ ] Yes, I have a minimal reproduction demo to help resolve this issue more effectively!

### Are you willing to submit a pull request to fix on your own?

- [x] Yes I am willing to submit a pull request on my own!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start at AbstractDirectory and inspect how BitList.emptyList() is assigned and subsequently changed during invocation. Reproduce the issue with two interfaces in different applications on Dubbo 3.3.6 and JDK 1.8. Done means traffic consistently reaches the correct interface instances and the second invocation no longer raises a no-such-method error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.