Skip to content

应用关闭时报错 #4247

@fenston

Description

@fenston

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。另外请按照如下要求提交相关信息节省社区维护同学的理解成本,否则该讨论极有可能直接被忽视或关闭。
We recommend using English. If you are non-native English speaker, you can use the translation software. We recommend using English. If you are non-native English speaker, you can use the translation software. In addition, please submit relevant information according to the following requirements to save the understanding cost of community maintenances, otherwise the discussion is very likely to be ignored or closed directly.

Which Component
eg. Nacos Discovery, Sentinel

Describe the bug
A clear and concise description of what the bug is.
应用关闭时报错,报错日志如下

2026-02-05 18:32:36.182 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : Shutdown naming grpc client proxy for uuid->801b6ebc-3cdc-4902-a027-405de8b04db8
2026-02-05 18:32:36.182 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : Shutdown grpc redo service executor java.util.concurrent.ScheduledThreadPoolExecutor@7699bf76[Running, pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 119]
2026-02-05 18:32:36.182 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.common.remote.client : Shutdown rpc client, set status to shutdown
2026-02-05 18:32:36.182 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.common.remote.client : Shutdown client event executor java.util.concurrent.ScheduledThreadPoolExecutor@24049fed[Running, pool size = 2, active threads = 2, queued tasks = 0, completed tasks = 0]
2026-02-05 18:32:36.182 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.common.remote.client : Close current connection 1770287195645_192.168.134.1_8996
2026-02-05 18:32:36.185 [system-admin,,,] [licationShutdownHook] INFO 7444 --- c.a.n.c.remote.client.grpc.GrpcClient : Shutdown grpc executor java.util.concurrent.ThreadPoolExecutor@536f0b6a[Running, pool size = 6, active threads = 0, queued tasks = 0, completed tasks = 154]
2026-02-05 18:32:36.185 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : shutdown and remove naming rpc client for uuid ->801b6ebc-3cdc-4902-a027-405de8b04db8
2026-02-05 18:32:36.185 [system-admin,,,] [licationShutdownHook] ERROR 7444 --- c.a.c.n.r.NacosGracefulShutdownDelegate : Error occurred while performing Nacos client graceful shutdown

java.lang.NullPointerException: Cannot read field "sharePublisher" because "com.alibaba.nacos.common.notify.NotifyCenter.INSTANCE" is null
at com.alibaba.nacos.common.notify.NotifyCenter.deregisterSubscriber(NotifyCenter.java:242)
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.shutdown(NamingGrpcClientProxy.java:537)
at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.shutdown(NamingClientProxyDelegate.java:212)
at com.alibaba.nacos.client.naming.NacosNamingService.shutDown(NacosNamingService.java:637)
at com.alibaba.cloud.nacos.NacosServiceManager.nacosServiceShutDown(NacosServiceManager.java:117)
at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.close(NacosServiceRegistry.java:120)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.stop(AbstractAutoServiceRegistration.java:311)
at com.alibaba.cloud.nacos.registry.NacosGracefulShutdownDelegate.doGracefulShutdown(NacosGracefulShutdownDelegate.java:69)
at com.alibaba.cloud.nacos.registry.NacosGracefulShutdownDelegate.onApplicationEvent(NacosGracefulShutdownDelegate.java:64)
at com.alibaba.cloud.nacos.registry.NacosGracefulShutdownDelegate.onApplicationEvent(NacosGracefulShutdownDelegate.java:34)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:454)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:387)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1166)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:179)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1129)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:147)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:116)
at java.base/java.lang.Thread.run(Thread.java:1583)

2026-02-05 18:32:36.207 [system-admin,,,] [licationShutdownHook] INFO 7444 --- o.s.b.w.e.tomcat.GracefulShutdown : Commencing graceful shutdown. Waiting for active requests to complete
2026-02-05 18:32:36.219 [system-admin,,,] [ tomcat-shutdown] INFO 7444 --- o.s.b.w.e.tomcat.GracefulShutdown : Graceful shutdown complete
2026-02-05 18:32:36.228 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : com.alibaba.nacos.client.naming.cache.ServiceInfoHolder do shutdown begin
2026-02-05 18:32:36.228 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : com.alibaba.nacos.client.naming.backups.FailoverReactor do shutdown begin
2026-02-05 18:32:36.228 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : com.alibaba.nacos.client.naming.backups.FailoverReactor do shutdown stop
2026-02-05 18:32:36.228 [system-admin,,,] [licationShutdownHook] INFO 7444 --- com.alibaba.nacos.client.naming : com.alibaba.nacos.client.naming.cache.ServiceInfoHolder do shutdown stop

Simplest demo
The URL of the simplest demo to reproduce the problem.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
e.g. MacOS 、Java8 、 Version 0.2.1.RELEASE
java21
spring-boot 3.5.10
spring-cloud.version 2025.0.0
spring-cloud-alibaba 2025.0.0.0
nacos server 3.1.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions