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

[ISSUE #9393] 设置线程为守护线程,保证在main线程推出时应用程序能过正常关闭。 #9396

Merged
merged 3 commits into from
Nov 3, 2022

Conversation

YunWZ
Copy link
Contributor

@YunWZ YunWZ commented Oct 25, 2022

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

To fix #9393

优化下面的后台线程,保证在nacos服务端启动失败时,进程能够正常关闭。

  • "I/O dispatcher xx" / ""pool-xx-thread-xx" : 在 NacosAsyncRestTemplate 中使用,用于处理异步HTTP请求; 优化:设置为守护线程;
  • "/Users/xx/nacos/data/tps" : 在 WatchFileCenter 中使用,用于监视文件;优化:shutdown方法中关闭watchService,退出while循环;
  • "handle events" : 在 nacos-istio 模块中使用,用于同步数据给Istio。优化:设置为守护线程。
  • "RpcScheduledExecutor" : 在GrpcConnection中使用。优化:设置为守护线程。

Brief changelog

如上所述。

Verifying this change

配置错误的配置项,则nacos服务端启动失败,进程退出。例如下面的配置:
propteries server.port=foo

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

  • Make sure there is a Github issue filed 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 [ISSUE #123] Fix UnknownException when host config not exist. 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.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

@codecov-commenter
Copy link

Codecov Report

Merging #9396 (1e7149e) into develop (308d772) will decrease coverage by 0.10%.
The diff coverage is 4.76%.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #9396      +/-   ##
=============================================
- Coverage      44.11%   44.01%   -0.11%     
+ Complexity      4890     4887       -3     
=============================================
  Files            915      915              
  Lines          33215    33215              
  Branches        3849     3849              
=============================================
- Hits           14654    14618      -36     
- Misses         17136    17172      +36     
  Partials        1425     1425              
Impacted Files Coverage Δ
...alibaba/nacos/api/remote/RpcScheduledExecutor.java 0.00% <0.00%> (ø)
...a/nacos/common/http/AbstractHttpClientFactory.java 0.00% <0.00%> (ø)
...libaba/nacos/common/http/HttpClientBeanHolder.java 0.00% <0.00%> (ø)
...va/com/alibaba/nacos/sys/file/WatchFileCenter.java 0.00% <0.00%> (ø)
...ba/nacos/common/task/engine/TaskExecuteWorker.java 63.15% <50.00%> (ø)
.../naming/push/v1/NamingSubscriberServiceV1Impl.java 66.66% <0.00%> (-15.88%) ⬇️
...alibaba/nacos/client/config/impl/ClientWorker.java 50.77% <0.00%> (-4.64%) ⬇️
...cos/core/cluster/remote/ClusterRpcClientProxy.java 72.85% <0.00%> (-1.43%) ⬇️
...va/com/alibaba/nacos/naming/misc/SwitchDomain.java 52.22% <0.00%> (-0.56%) ⬇️
...a/com/alibaba/nacos/naming/push/v1/PushClient.java 46.93% <0.00%> (ø)

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 308d772...1e7149e. Read the comment docs.

@YunWZ YunWZ force-pushed the develop-9393 branch 4 times, most recently from f2e5300 to 415d2f3 Compare October 27, 2022 11:20
hayya33
hayya33 previously approved these changes Oct 27, 2022
@KomachiSion KomachiSion added the kind/enhancement Category issues or prs related to enhancement. label Nov 3, 2022
@KomachiSion KomachiSion added this to the 2.2.0 milestone Nov 3, 2022
@KomachiSion KomachiSion merged commit 506bc26 into alibaba:develop Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nacos服务端启动失败但进程没有退出
4 participants