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

only process context event of original application context #9637

Merged
merged 1 commit into from
Jan 29, 2022

Conversation

jessin20161124
Copy link
Contributor

What is the purpose of the change

The DubboDeployApplicationListener currently processes all applicationContext event from current ApplicationContext and all its child applicationContext. It will cause duplicate deployment and ApplicationDeployListener will receive multi duplicate vents. The most bad is that, when the application uses hot load of child spring context, and destroys the child spring context at runtime, the dubbo infrastructure will be destroyed once receives the child spring context's ContextClosedEvent.

Brief changelog

dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboConfigApplicationListener.java
dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java

Verifying this change

see the case code in https://github.com/jessin20161124/dubbo_demo.

  1. java -Dspring.profiles.active=provider -Dserver.port=9999 -jar target/dubbo_demo-0.0.1-SNAPSHOT.jar
  2. curl http://localhost:9999/practice/testGetSubApp
  3. curl http://localhost:9999/practice/testDestroySubApp
  4. watch the application log, the dubbo application runs normally.

Checklist

  • 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.
  • 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.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • 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.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@chickenlj
Copy link
Contributor

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2022

Codecov Report

Merging #9637 (a2dabb5) into 3.0 (65bd70b) will increase coverage by 0.13%.
The diff coverage is 62.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.0    #9637      +/-   ##
============================================
+ Coverage     65.53%   65.67%   +0.13%     
  Complexity      296      296              
============================================
  Files          1188     1191       +3     
  Lines         51785    52070     +285     
  Branches       7829     7909      +80     
============================================
+ Hits          33939    34196     +257     
- Misses        14173    14188      +15     
- Partials       3673     3686      +13     
Impacted Files Coverage Δ
...spring/context/DubboConfigApplicationListener.java 73.33% <33.33%> (-5.24%) ⬇️
...spring/context/DubboDeployApplicationListener.java 75.00% <80.00%> (-1.60%) ⬇️
...va/org/apache/dubbo/rpc/protocol/tri/Metadata.java 75.00% <0.00%> (-25.00%) ⬇️
.../main/java/org/apache/dubbo/rpc/FutureContext.java 70.58% <0.00%> (-21.08%) ⬇️
.../dubbo/rpc/protocol/tri/command/QueuedCommand.java 68.75% <0.00%> (-15.87%) ⬇️
...he/dubbo/common/bytecode/DubboLoaderClassPath.java 87.50% <0.00%> (-12.50%) ⬇️
...n/java/org/apache/dubbo/config/AbstractConfig.java 71.83% <0.00%> (-9.05%) ⬇️
...ache/dubbo/rpc/protocol/tri/UnaryServerStream.java 54.00% <0.00%> (-6.00%) ⬇️
...che/dubbo/common/config/InmemoryConfiguration.java 94.73% <0.00%> (-5.27%) ⬇️
...gcenter/wrapper/CompositeDynamicConfiguration.java 67.50% <0.00%> (-5.00%) ⬇️
... and 79 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 65bd70b...a2dabb5. Read the comment docs.

@chickenlj chickenlj added this to the 3.0.6 milestone Jan 29, 2022
@chickenlj chickenlj merged commit 467d832 into apache:3.0 Jan 29, 2022
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.

3 participants