lineng-hao-jie opened a new issue, #14859:
URL: https://github.com/apache/dubbo/issues/14859

   ### 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.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:
   ```
   2024-11-05 09:13:11,578 INFO [main] [InternalServiceConfigBuilder.java:209] 
-  [DUBBO] org.apache.dubbo.metadata.MetadataServiceService Port hasn't been 
set will use default protocol defined in protocols., dubbo version: 3.2.16, 
current host: 192.168.10.10
   2024-11-05 09:13:11,579 INFO [main] [InternalServiceConfigBuilder.java:266] 
-  [DUBBO] Using dubbo protocol to export 
org.apache.dubbo.metadata.MetadataService service on port 18185, dubbo version: 
3.2.16, current host: 192.168.10.10
   2024-11-05 09:13:11,642 INFO [main] [ServiceConfig.java:965] -  [DUBBO] 
Export dubbo service org.apache.dubbo.metadata.MetadataService to local 
registry url : 
injvm://127.0.0.1/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=travel-wuling&application.version=1.0.0&background=false&bind.ip=192.168.10.10&bind.port=18185&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&environment=product&executor-management-mode=isolation&exporter.listener=injvm&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=travel-wuling&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,version&owner=travel-wuling&pi
 
d=3536&prefer.serialization=fastjson2,hessian2&qos.enable=false&register=false&register-mode=instance&release=3.2.16&revision=3.2.16&service.filter=-default&side=provider&timestamp=1730769191606&version=1.0.0,
 dubbo version: 3.2.16, current host: 192.168.10.10
   2024-11-05 09:13:11,642 INFO [main] [ServiceConfig.java:923] -  [DUBBO] 
Export dubbo service org.apache.dubbo.metadata.MetadataService to url 
dubbo://192.168.10.10:18185/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=travel-wuling&application.version=1.0.0&background=false&bind.ip=192.168.10.10&bind.port=18185&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&environment=product&executor-management-mode=isolation&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=travel-wuling&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,version&owner=travel-wuling&pid=3536&prefer.serialization=fas
 
tjson2,hessian2&qos.enable=false&register=false&register-mode=instance&release=3.2.16&revision=3.2.16&service.filter=-default&side=provider&timestamp=1730769191606&version=1.0.0,
 dubbo version: 3.2.16, current host: 192.168.10.10
   2024-11-05 09:13:11,644 INFO [main] 
[ConfigurableMetadataServiceExporter.java:80] -  [DUBBO] The MetadataService 
exports urls : 
[dubbo://192.168.10.10:18185/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=travel-wuling&application.version=1.0.0&background=false&bind.ip=192.168.10.10&bind.port=18185&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&environment=product&executor-management-mode=isolation&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=travel-wuling&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,version&owner=travel-wuling&pid=3536&prefer.serialization=fastjson2,hessia
 
n2&qos.enable=false&register=false&register-mode=instance&release=3.2.16&revision=3.2.16&service.filter=-default&side=provider&timestamp=1730769191606&version=1.0.0],
 dubbo version: 3.2.16, current host: 192.168.10.10
   ```
   
   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:
   ```
   private void doExportMetadataService() {
           if (!isStarting() && !isStarted() && !isCompletion()) {
               return;
           }
           for (DeployListener<ApplicationModel> listener : listeners) {
               ...
           }
       }
   ```
   
   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:
   ```
   <dubbo:service interface="com.huntlee.travel.ai.llm.agent.api.DubboBug" 
id="dubboBugService" ref="dubboBug"/>
   ```
   
   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?
   
   - [ ] 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)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to