-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] When registering services programmatically in Dubbo 3.3.x, the instance - level service registration is invalid. #14859
Comments
i have tested dubbo 3.3.1, it successed to register app instance programmatically. ServiceConfig<Greeter> service = new ServiceConfig<>();
service.setInterface(Greeter.class);
service.setRef(new GreeterImpl());
DubboBootstrap.getInstance().getCache().get(App.class);
RegistryConfig registryConfig = new RegistryConfig("nacos://127.0.0.1:8848");
registryConfig.setRegisterMode("instance");
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
bootstrap.application(new ApplicationConfig("tri-stub-server"))
.registry(registryConfig)
.protocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051))
.service(service)
.start();
System.out.println("Dubbo triple stub server started");
System.in.read(); you can paste your code for further discuss. |
Is it possible that it is related to the combination of configuration and programming? In my case, only the service exposure is achieved through programming, while the rest are through configuration. The specific configurations are as follows:
Code snippet of service exposure:
|
You can debug or print out if the configuration parameters you got programmatically are correct. |
The code for service exposure should be fine. It has been running normally from version 2.5.1 to 2.7.9, and all the way to 3.2.10/3.2.16. Even the interface - level service registration of 3.3.1 can also operate normally. In addition, debugging was also performed in version 3.3.1, and it was found that the line in the problem description returned directly (line 1302 of DefaultApplicationDeployer).
Furthermore, if a "dubbo:service" configuration item is added to the configuration file, the instance - level service registration will eventually be normal as well.For example:
|
test.zip
2.dubbo 3.3.1
|
i think there is bug. your case is special, config combine xml and program. when spring container started, there is no service config in xml, so missed the register process. then service export programmatically. in past version there is a schedule to register the instance, so it can be registered successfully. but now it bypassed by a condition. i will try to fix it. |
thanks! |
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
dubbo 3.3.x ,jdk openjdk-21.0.2 ,windows11
nacos server 2.3.0,nacos-client 2.3.0/2.4.3
Steps to reproduce this issue
When upgrading from 3.2.10/3.2.16 to 3.3.x, it was found that instance - level services could not be registered. The specific manifestations are as follows:
1)Dubbo service calls failed and no services were found.
2)There are no corresponding service registration records in the "Service Management - Service List" in the Nacos console.
What you expected to happen
By comparing the startup logs of 3.2.x and 3.3.x, it was found that the 3.3.x version lacks the metadata service registration information. Specifically, the following lines of logs are missing:
After tracing the code, it was found that the DefaultApplicationDeployer (v3.3.1) was not executed after line 1302, and it returned in the previous judgment. Specifically:
It is suspected that the startup in the new version has some scenarios not considered in the marker control. The differences in startup logic between the two versions have not been compared yet. We have encapsulated a layer on top of Dubbo ourselves, and the registration of services is done programmatically, specifically through ServiceConfig.export(). Additionally, I have also tested that as long as a service is configured in the configuration mode, the service registration information is normal, for example:
That is to say, in the 3.3.x version, when services(instance level) are registered programmatically, there are problems with service registration. Additionally, it has also been tested that if the service registration is configured as an interface - level service, there is no problem either.
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
The text was updated successfully, but these errors were encountered: