You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "LiZhenNet (GitHub)" <gi...@apache.org> on 2018/12/06 11:55:08 UTC

[GitHub] [incubator-dubbo] LiZhenNet opened pull request #2901: Graceful shutdown enhancement in Spring

## 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 :https://github.com/apache/incubator-dubbo/issues/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:

- [x] Make sure there is a [GITHUB_issue](https://github.com/apache/incubator-dubbo/issues) 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 integration-test in [test module](https://github.com/apache/incubator-dubbo/tree/master/dubbo-test).
- [ ] Run `mvn clean install -DskipTests` & `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](https://github.com/apache/incubator-dubbo/wiki/Software-donation-guide).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2901 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] beiwei30 closed pull request #2901: Graceful shutdown enhancement in Spring

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
[ pull request closed by beiwei30 ]

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2901 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] codecov-io commented on issue #2901: Graceful shutdown enhancement in Spring

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=h1) Report
> Merging [#2901](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/63bf28da8c173f474a5643ca716876db2d3aae9a?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/graphs/tree.svg?width=650&token=VnEIkiFQT0&height=150&src=pr)](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=tree)

```diff
@@            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
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ava/org/apache/dubbo/config/DubboShutdownHook.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9EdWJib1NodXRkb3duSG9vay5qYXZh) | `84% <100%> (ø)` | :arrow_up: |
| [...onfig/spring/extension/SpringExtensionFactory.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvZXh0ZW5zaW9uL1NwcmluZ0V4dGVuc2lvbkZhY3RvcnkuamF2YQ==) | `84.61% <100%> (+0.4%)` | :arrow_up: |
| [...ache/dubbo/remoting/p2p/support/AbstractGroup.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctcDJwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9wMnAvc3VwcG9ydC9BYnN0cmFjdEdyb3VwLmphdmE=) | `45.45% <0%> (-11.37%)` | :arrow_down: |
| [...in/java/org/apache/dubbo/common/utils/JVMUtil.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvSlZNVXRpbC5qYXZh) | `73.58% <0%> (-7.55%)` | :arrow_down: |
| [.../apache/dubbo/remoting/transport/AbstractPeer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvQWJzdHJhY3RQZWVyLmphdmE=) | `58.69% <0%> (-4.35%)` | :arrow_down: |
| [...dubbo/remoting/exchange/support/DefaultFuture.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9leGNoYW5nZS9zdXBwb3J0L0RlZmF1bHRGdXR1cmUuamF2YQ==) | `66.44% <0%> (-3.36%)` | :arrow_down: |
| [...org/apache/dubbo/rpc/protocol/AbstractInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9wcm90b2NvbC9BYnN0cmFjdEludm9rZXIuamF2YQ==) | `62.9% <0%> (-3.23%)` | :arrow_down: |
| [...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NhbGxiYWNrU2VydmljZUNvZGVjLmphdmE=) | `77.2% <0%> (-2.21%)` | :arrow_down: |
| [...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tbW9uaXRvci9kdWJiby1tb25pdG9yLWRlZmF1bHQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL21vbml0b3IvZHViYm8vRHViYm9Nb25pdG9yLmphdmE=) | `87.85% <0%> (-1.87%)` | :arrow_down: |
| [...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvUHJvdG9jb2wuamF2YQ==) | `65.83% <0%> (-0.84%)` | :arrow_down: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-dubbo/pull/2901/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=footer). Last update [63bf28d...f6a3213](https://codecov.io/gh/apache/incubator-dubbo/pull/2901?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2901 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org