apache / apache/dubbo-website

优雅停机与Spring boot配合使用的问题

Open
#2,783 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
491
Forks
809
Avg merge
1d 6h
Merged PRs (30d)
6

Description

https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/advanced-features-and-usage/others/graceful-shutdown/ 这个页面中注意事项第4条这么说的:
> 如果使用了 SpringBoot,Dubbo 的 ShutdownHook 会在 SpringBoot 的 ShutdownHook 之前执行

我用的是spring boot3.x,也配置了Spring boot 的`server: shutdown: graceful`. 但是还会有个问题,就是用kill PID(其实是docker stop)的方式终止的时候dubbo先关闭服务,但是spring 还有请求过来,spring的controller中有调用其他dubbo服务,这时候dubbo服务已经关闭了,调用其他服务就会出现如下错误
```
java.util.concurrent.ExecutionException: org.apache.dubbo.rpc.RpcException: Directory of type RegistryDirectory already destroyed for service com.xxx.user.rpc.UserRpc from registry nacos://192.168.100.240:8848/org.apache.dubbo.registry.RegistryService?application=xxx-service&dubbo=2.0.2&environment=product&executor-management-mode=isolation&file-cache=true&logger=slf4j&organization=xx&owner=xxx&pid=1&qos.enable=true&qos.port=28029®ister-mode=instance&release=3.2.0&serialize.check.status=WARN&shutwait=5000×tamp=1689590386952
```
请问正常是会有这个问题吗还是哪里配置的问题

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked graceful-shutdown documentation, especially the fourth note, and compare its stated shutdown-hook order with Spring Boot 3.x graceful shutdown behavior. Reproduce the Docker stop case using the reported RegistryDirectory error and determine whether the documentation or configuration guidance is wrong; done means the page clearly explains the supported ordering and resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, spring-boot
Domain
backend, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.