apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.41k stars 26.42k forks source link

[Bug] The version is upgraded, causing the broadcast mode to be unavailable #14280

Open nuoqin opened 4 months ago

nuoqin commented 4 months ago

Pre-check

Search before asking

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo JAVA 2.7.6 JDK 1.8.211 windows10

Steps to reproduce this issue

the problem is from version 2.7.6 to version 2.7.23 3.0.X, the code has not changed in any way, there are detailed screenshots in it

Here's the code

import com.caas.dubbo.service.CacheService;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;

/**
 * @Description TODO
 * @Author nuoqin
 * @DATA 2024/6/4 9:47
 */
public class BroadCastTest {

    public static void main(String[] args) {

        //this is 2.7.23
        ReferenceConfig<CacheService> reference = new ReferenceConfig<>();
        reference.setApplication(new ApplicationConfig("canal-dubbo-consumer-1"));
        RegistryConfig registryConfig = new RegistryConfig("zookeeper://192.168.250.46:2181");
        registryConfig.setCluster("broadcast");
        reference.setRegistry(registryConfig);

        reference.setRetries(0);
        reference.setInterface(CacheService.class);

        CacheService service = reference.get();

        System.out.println(service.updateCache());

    }
}

What you expected to happen

When I upgraded the system from dubbo 2.7.6 to 2.7.23, 3.0.X, I found that the 2.7.6 settings broadcast can be placed in "registryConfig.setCluster("broadcast"); But after the upgrade, it was found that the service was called again, and only one service got a response. before 2.7.6 f22152c614f0b0a3f910a76fc8dac6d after 2.7.23 2539a909f4ec19ca5e92d4bd12c6235

The picture above is a piece of test code that I wrote based on our business,

Anything else

No response

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

Code of Conduct

wcy666103 commented 4 months ago

I`m working on it

wcy666103 commented 4 months ago

I tested these versions and the results were fine: dubbo3.0.4 spring boot2.7.18-SNAPSHOT jdk8 jdk17 springboot 2.3.12.RELASE dubbo2.7.21 jdk8

nuoqin commented 4 months ago

project.zip

This is my processed code. You can try packaging it and running it on two servers.

image

Above is a project structure I constructed

caas-dubbo-2、caas-dubbo-3,These two are a springboot project,Used to provide service calls.

caas-dubbo-consumer-276、caas-dubbo-consumer-2723、caas-dubbo-consumer-308,These three representative projects are used for broadcasting calls.The numerical suffix represents the version of dubbo(e.g: 276 = dubbo 2.7.6 version). There is no problem with caas-dubbo-consumer-276。

Therefore, you can test this project on two or more services,Thank you again for taking the time to answer amidst your busy schedule