Skip to content
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

About the application of spring management repeated monitoring processing dubbo shutdown #7420

Closed
wants to merge 9 commits into from

Conversation

xiaoheng1
Copy link
Contributor

What is the purpose of the change

About the application of spring management repeated monitoring processing dubbo shutdown.

see more detail from #7093

Brief changelog

XXXXX

Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link

codecov-io commented Mar 24, 2021

Codecov Report

Merging #7420 (fc20d59) into master (b5c81d8) will increase coverage by 0.35%.
The diff coverage is 77.77%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7420      +/-   ##
============================================
+ Coverage     58.71%   59.06%   +0.35%     
- Complexity      422      456      +34     
============================================
  Files          1043     1043              
  Lines         42514    42524      +10     
  Branches       6208     6226      +18     
============================================
+ Hits          24962    25117     +155     
+ Misses        14769    14619     -150     
- Partials       2783     2788       +5     
Impacted Files Coverage Δ Complexity Δ
...ing/context/DubboBootstrapApplicationListener.java 90.90% <77.77%> (-9.10%) 0.00 <0.00> (ø)
...che/dubbo/remoting/transport/mina/MinaChannel.java 35.52% <0.00%> (-14.48%) 14.00% <0.00%> (-2.00%)
.../apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java 62.06% <0.00%> (-10.35%) 0.00% <0.00%> (ø%)
...ache/dubbo/remoting/transport/mina/MinaServer.java 53.33% <0.00%> (-10.00%) 5.00% <0.00%> (-1.00%)
...dubbo/remoting/exchange/support/DefaultFuture.java 80.34% <0.00%> (-6.84%) 0.00% <0.00%> (ø%)
.../threadpool/manager/DefaultExecutorRepository.java 79.03% <0.00%> (-4.84%) 0.00% <0.00%> (ø%)
...ng/transport/dispatcher/WrappedChannelHandler.java 58.69% <0.00%> (-4.35%) 0.00% <0.00%> (ø%)
.../dubbo/remoting/transport/netty4/NettyChannel.java 62.37% <0.00%> (-3.97%) 0.00% <0.00%> (ø%)
...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java 86.66% <0.00%> (-1.91%) 16.00% <0.00%> (ø%)
...src/main/java/org/apache/dubbo/common/Version.java 70.87% <0.00%> (-1.86%) 0.00% <0.00%> (ø%)
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5c81d8...fc20d59. Read the comment docs.

@AlbumenJ AlbumenJ added this to the 2.7.10 milestone Mar 27, 2021
@kylixs
Copy link
Member

kylixs commented Mar 29, 2021

There seems to be a problem with the stop logic. The Shutdown hook is called by the JVM before the JVM exits. It is not good to wait for the dubbo shutdown hook to complete in the Spring close event. Actually Spring also registered shutdown hook, please check org.springframework.context.support.AbstractApplicationContext#registerShutdownHook().

  • In the Spring scenario, perhaps we should listen to Spring events to shut down dubbo instead of using shutdown hook. In this case, the life cycle of dubbo is consistent with spring.
  • In the Dubbo API scenario, the shutdown hook needs to be registered.

@xiaoheng1
Copy link
Contributor Author

Now it is precisely because of the existence of Spring hook and Dubbo Hook. As a result, Spring did not block when closing dubbo, and then continued to execute the destruction of Spring Bean. At this time, Dubbo has not completed the destruction, which will cause the database connection not to be obtained. It may be a way to cancel Dubbo Hook directly after hosting to the Spring container.

@xiaoheng1
Copy link
Contributor Author

like #7317.

If the idea of #7317 is used, should the callback be removed from ShutdownHook? ShutDownHook only calls DubboBootstrap.stop to complete the resource wave work.

@kylixs
Copy link
Member

kylixs commented Mar 29, 2021

For clarity of responsibilities, the processing logic of dubbo destroy should extracted from the Dubbo shutdown hook, and called it separately in the Spring scenario without relying on the Dubbo shutdown hook.

@xiaoheng1
Copy link
Contributor Author

So when shutting down the Dubbo service in Spring, do you tend to cancel the registration of DubboShutDownHook?

@AlbumenJ AlbumenJ modified the milestones: 2.7.10, 2.7.11 Apr 2, 2021
@AlbumenJ AlbumenJ modified the milestones: 2.7.11, 2.7.12 May 6, 2021
@xiaoheng1 xiaoheng1 closed this May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants