Skip to content

tschlat/spring-boot-3-5-8-undertow-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot 3.5.8 Undertow @DirtiesContext Bug

Minimal reproduction project for a regression in Spring Boot 3.5.8 causing NullPointerException in Undertow during test context cleanup.

Issue

After upgrading from Spring Boot 3.5.7 to 3.5.8, tests using @DirtiesContext with Undertow fail with:

java.lang.NullPointerException: Cannot invoke "io.undertow.servlet.core.DeploymentImpl.getDeploymentState()" because "this.deployment" is null
    at io.undertow.servlet.core.DeploymentManagerImpl.stop(DeploymentManagerImpl.java:615)
    at org.springframework.boot.web.embedded.undertow.DeploymentManagerHttpHandlerFactory$DeploymentManagerHandler.close(DeploymentManagerHttpHandlerFactory.java:80)
    at org.springframework.boot.web.embedded.undertow.UndertowWebServer.destroy(UndertowWebServer.java:294)

Root Cause

Probably a regression introduced by fix for #48061 (backport of #47141). The separation of stop() and destroy() in UndertowWebServer causes DeploymentManagerImpl.stop() to be called when deployment is already null.

Reproduction

git clone https://github.com/tschlat/spring-boot-3-5-8-undertow-issue.git
cd spring-boot-3-5-8-undertow-issue
mvn verify

Expected: All tests pass.

Actual: DirtiesContextIT fails with NullPointerException. NotDirtiesContextIT succeeds.

Conditions

  • Spring Boot 3.5.8 (works in 3.5.7)
  • Undertow as embedded server
  • @DirtiesContext annotation
  • WebEnvironment.RANDOM_PORT
  • Complex application context (e.g., Citrus Simulator beans)

Workaround

Downgrade to Spring Boot 3.5.7:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.5.7</version>
</parent>

About

Sample project to reproduce the regression on spring boot 3.5.7 -> 3.5.8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages