-
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
Graceful shutdown enhancement in Spring #2901
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 6, 2018
Codecov Report
@@ Coverage Diff @@
## master #2901 +/- ##
==========================================
- Coverage 63.74% 63.71% -0.03%
==========================================
Files 577 577
Lines 25930 25931 +1
Branches 4540 4540
==========================================
- Hits 16529 16522 -7
- Misses 7233 7235 +2
- Partials 2168 2174 +6
Continue to review full report at Codecov.
|
bpaull1981
approved these changes
Dec 6, 2018
khanimteyaz
pushed a commit
to khanimteyaz/incubator-dubbo
that referenced
this pull request
Dec 17, 2018
beiwei30
pushed a commit
that referenced
this pull request
Dec 17, 2018
* added dubbo-rpc-api filter documentation for issue no #2935 * wrong @see java.io.File was added, removed this version of checkins * Close all ports after tests finish (#2906) * fix testCustomExecutor (#2904) * Graceful shutdown enhancement in Spring (#2901) * Simplify the code logic of the method AbstractClusterInvoker#reselect. (#2826) * Simplify the code logic of the method AbstractClusterInvoker#reselect. * Minor modification for code style. * create AbstractRouter (#2909) * create AbstractRouter * router default method * router default method * router default method * mockinvoker * Added javadoc for dubbo-filter module dubbo github issue 2884 (#2921) * Enhance unit test (#2920) * Change Readme dubbo-sample hyperlink (#2927) * Simply TagRouter (#2924) * make telnet config work again (#2925) * Remove the log to putRandomPort when one protocol use random port (#2931) * optimize findConfigedPorts method of ServiceConfig to log only one time when userandom port * move the log to method putRandomPort * Fix DubboShutdownHook Memory Leak (#2922) * Improve UT grammar and remove unnecessary braces. (#2930) * Improve UT grammer, fix compiler warnings. * Remove unnecessary braces. * re-enable testCustomExecutor (#2917) * fix testCustomExecutor * fix ci * Fixing test-order dependency for FstObjectInputTest (#2815) * re-enable testCustomExecutor (#2913) * Resetting ExtensionLoader to remove test order dependencies in StickyTest (#2807) * optimize the RondRobinLoadBalance and MockClusterInvoker (#2932) delete unused logic and take the logger out. * [Dubbo-2864] Fix build failed with -Prelease (#2923) fixes #2864 * Fix telnet can not find method with enum type (#2803) * [dubbo-2766] fix the bug of isMatch method of InvokeTelnetHandler (#2787) * enhance org.apache.dubbo.rpc.protocol.dubbo.telnet.InvokeTelnetHandler#isMatch (#2941) * enhance isMatch * remove useless imports * [Dubbo-2766]Fix 2766 and enhance the invoke command (#2801) * add getter and setter for ServiceConfig's interfaceName property#2353 * add interfaceName to ignoreAttributeNames and change the unit test * delete the demo source code and update the unit test * unchange ServiceConfig * update unit test * update unit test * fix #2798 and enhance invoke command * Delete useless assignments (#2939) * Replace anonymous class with method reference (#2929) * Replace anonymous class with method reference * Revert changes as per @beiwei30 code review * Optimize retry for FailbackRegistry. (#2763) * Abstract retry task * Task for retry. * Fix sth. * Finish Optimize. fix ci failed. * Optimize retry for FailbackRegistry. The retry operation splits into specific operations, such as subscriptions and registrations. This approach allows for very precise retry control. * Optimize retry for FailbackRegistry. The retry operation splits into specific operations, such as subscriptions and registrations. This approach allows for very precise retry control. * Optimize logger warn's msg. * Optimize FailedNotifiedTask's run method. Optimize addXXXTask, directly return if we already have a retry task. * Optimize notify logic, just notify when the urls is not empty. * Optimize notify logic, just notify when the urls is not empty. * Optimize timer that use daemon thread. * standardize semantics of all mergers,enhance mergeFactory and testcase (#2936) * Modified to lower camel case (#2945) * Improve several map iteration (#2938) * added dubbo-rpc-api filter documentation for issue no #2935 * wrong @see java.io.File was added, removed this version of checkins
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Graceful shutdown enhancement in Spring.
AbstractConfig has added a DubboShutdownHook in its constructed function,but when we used spring, SpringExtensionFactory also added a ApplicationListener to invoke DubboShutdownHook when spring fired ContextClosedEvent.
This seems to have a problem。 AbstractConfig‘s DubboShutdownHook will invoke when the application shutdown, at the same time spring boot shutDownhook will invoke to close the context。
when the application closing ,dubbo will make sure all the request has return ,if a request used bean in spring , this bean will close by context。 it will throw error,so in spring ,we should make sure dubbo shutdown before spring destory its beans。
我怕我英文没有表达清楚,用中文简单描述一下。正好也在解决这个问题,当我的应用在使用spring boot 时,spring boot 会注册一个shutdownhook 来关闭 applicationcontext ,同时 Dubbo 也会注册 shutdownhook, 但是我们没办法保证两个shutdownhook的执行顺序。因为dubbo 的优雅停机 会把已经进来的请求处理完,当这些请求依赖spring 的某些bean 时,这些bean 可能已经被spring 容器关闭了,产生了报错。我们应该确保dubbo完全停机了再关闭spring容器。
我目前的做法是取消了spring boot 注册的shutdownhook, 自己实现了一个shutdownhook ,运行时,先sleep(DEFAULT_SERVER_SHUTDOWN_TIMEOUT),再确保dubbo 停机后再关闭容器,如果 DEFAULT_SERVER_SHUTDOWN_TIMEOUT 过大的话,可能会拖延停机时间,这也是为什么我提了一个issue :#2877 。
Brief changelog
when add ShutdownHookListener ,remove AbstractConfig‘s DubboShutdownHook
Verifying this change
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.