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

Webflux server gracefulshutdown throws NullPointerException #35264

Closed
giger85 opened this issue May 4, 2023 · 2 comments
Closed

Webflux server gracefulshutdown throws NullPointerException #35264

giger85 opened this issue May 4, 2023 · 2 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@giger85
Copy link

giger85 commented May 4, 2023

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 4, 2023
@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 4, 2023
@mhalbritter mhalbritter added this to the 3.1.x milestone May 4, 2023
@mhalbritter
Copy link
Contributor

mhalbritter commented May 4, 2023

Thanks for the report, should be an easy fix.

@giger85
Copy link
Author

giger85 commented May 8, 2023

@mhalbritter
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants