When using Spring Boot 3.4.0 combined with Spring WebMVC, virtual threads, and lazy bean initialization, accessing /actuator/health during the application launch results in a pinned virtual thread.
This is a regression from Spring Boot 3.3.6 where this issue does not occur.
Problem
When using Spring Boot 3.4.0 combined with Spring WebMVC, virtual threads, and lazy bean initialization, accessing
/actuator/health
during the application launch results in a pinned virtual thread.This is a regression from Spring Boot 3.3.6 where this issue does not occur.
Sample App
This issue is demonstrated in https://github.com/chrisgleissner/spring-boot-3.4-pinned-thread-during-launch-issue:
Details
Start process that continuously calls /actuator/health:
Start Spring Boot app
Software Versions
Source code
build.gradle.kts
:src/main/java/com/example/demo/DemoApplication.java
:src/main/resources/application.yaml
:Expected Logs (Spring Boot 3.3.6)
No thread pinning detected.
Actual Logs (Spring Boot 3.4.0)
Thread pinning detected.
Monitors
This section shows the relevant code for each of the stack trace lines ending with
<== monitors:1
in the stack trace above.Monitor
Log:
Code:
Monitor
Log:
Code:
Monitor
Log:
Code: