Skip to content

Webflux server gracefulshutdown throws NullPointerException #35264

@giger85

Description

@giger85

Environment

  • spring boot: 3.0.2
  • jdk: Temurin-17.0.5+8 (build 17.0.5+8)
  • web server: webflux (netty)

Situation

I configured graceful shutdown and timeout.

spring: lifecycle: timeout-per-shutdown-phase: 90s server: shutdown: graceful

And sent signal SIGTERM to java process, but NPE occurred.
Here is stack trace.

java.lang.NullPointerException: Cannot invoke "java.lang.Thread.interrupt()" because "this.shutdownThread" is null at org.springframework.boot.web.embedded.netty.GracefulShutdown.abort(GracefulShutdown.java:81) at org.springframework.boot.web.embedded.netty.NettyWebServer.stop(NettyWebServer.java:193) at org.springframework.boot.web.reactive.context.WebServerManager.stop(WebServerManager.java:65) at org.springframework.boot.web.reactive.context.WebServerStartStopLifecycle.stop(WebServerStartStopLifecycle.java:48) at org.springframework.context.SmartLifecycle.stop(SmartLifecycle.java:117) at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:234) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:373) at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:206) at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:129) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1043) at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.doClose(ReactiveWebServerApplicationContext.java:149) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1001) at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:139) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:108) at java.base/java.lang.Thread.run(Thread.java:833) 

This situation is very rare, but this issue may be need to fix.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions