qq664042 opened a new issue, #14490:
URL: https://github.com/apache/dubbo/issues/14490

   ### 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
   
   2.7.22
   However, I found that versions 2.7.7 through 2.7.23 all have this bug, while 
version 2.7.3 does not have this bug.
   
   ### Steps to reproduce this issue
   
   When integrating Dubbo 2.7.22 in a Spring Boot project, and using 
dubbo:reference in dubbo.xml similar to:
   <dubbo:reference interface="com.xdd.test.demo44.remote.IUserServiceRemote" 
id="userServiceRemote"/>
   
   
   After starting the Spring Boot application, you will observe that the 
java.lang.ApplicationShutdownHooks.hooks variable contains an additional 
DubboShutdownHook object.
   
   ### What you expected to happen
   
   In the Dubbo consumer application, it can wait for the tasks to complete 
upon shutdown, up to a timeout of 10 seconds, rather than directly interrupting 
the tasks in progress.
   
   ### Anything else
   
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean
 first executes DubboShutdownHook.getDubboShutdownHook().unregister(). During 
the process of setting properties for the bean, 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean
 then executes DubboShutdownHook.getDubboShutdownHook().register().
   
   The order is reversed, causing the DubboShutdownHook to persist after the 
consumer starts. When the consumer stops, the DubboShutdownHook may execute 
before the SpringApplicationShutdownHook, directly shutting down tasks that 
haven't finished executing. This results in the "Interrupted unexpectedly while 
waiting for" exception.
   
![image](https://github.com/user-attachments/assets/9cf9ed0b-8af6-46c0-b61c-e948748d7394)
   
   This bug also exists in dubbo-2.7.23.
   
![企业微信截图_eb769e1c-6629-4441-a925-a0017cdff5e3](https://github.com/user-attachments/assets/725da234-9f96-4748-9e23-7311105561c3)
   
   I seem to have seen a similar issue, but not in this version: 
https://github.com/apache/dubbo/issues/7093.
   My current solution is to directly call 
DubboShutdownHook.getDubboShutdownHook().unregister() after the Spring Boot 
application starts.
   
   
   My English is not very good, but you can check the original link in Chinese:
   https://github.com/apache/dubbo/issues/14488
   
   
   ### 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)
   


-- 
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: notifications-unsubscr...@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to