-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Spring Boot tests hangs after 2.1.3.RELEASE -> 2.1.4.RELEASE upgrade (H2 regression) #16512
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
Comments
It's quite hard to say if this is a problem in Spring Boot, or if it's related to a dependency upgrade. It sounds like it might be am issue with Hikari, but without a sample to reproduce the problem it's almost impossible to say. One thing you could try is upgrading Spring Boot but then downgrading Hikari, H2 and any other database components to the previous versions. This might help identify if the problem is in one of those libraries or not. Other than that, I think we'll really need a way to reproduce the problem ourselves locally so we can debug things. |
Hello @philwebb Here my steps:
spring:
profiles:
active: h2
datasource:
hikari:
leak-detection-threshold: 3000
logging:
level:
root: 'debug'
Now tests are back to normal Don't know how to fix it in different way, but I'm Okay with that solution. In fact, we have quite a big mono repo with 60+/- sub modules, so maybe in such situations default configurations works not very well. Maybe on small project this issue will never occur Regards |
Reducing the leak detection as mentioned above I also found devtools in the stack trace. I was able to solve the issue by downgrading H2 from 1.4.199 to 1.4.197: testCompile("com.h2database:h2:1.4.197") |
@KurtMar thank you. We've got other reports pointing to H2 so I've flagged this one for team attention to see what we can do about it. |
Same issue on https://spring.io/guides/tutorials/spring-boot-kotlin/ when upgrading to Boot 2.1.4 or 2.2.0 milestones or snapshots. I can avoid the issue by setting H2 to |
Also maybe not related, but H2 |
For some reasons, I can't reproduce the issue this morning with Boot 2.2 snapshots and H2 |
See spring-projects/spring-boot#16512 **Cherry-pick to 5.0.x & 4.3.x**
See spring-projects/spring-boot#16512 **Cherry-pick to 5.0.x & 4.3.x**
See spring-projects/spring-boot#16512 **Cherry-pick to 5.0.x & 4.3.x** # Conflicts: # build.gradle
I'm going to close this one here since from our side there's very little that we can do. @KurtMar if you raise an H2 issue, would you be so kind as to provide a link here so that people who stumble on this issue can find it. |
What I found so far is that running the tests individually will not hang, but running all the tests will. This can be observed in https://github.com/spring-guides/tut-spring-boot-kotlin by updating Spring Boot to 2.1.4 and running I have created an issue in the h2 repo: h2database/h2database#1870. |
Thanks, @KurtMar. The H2 issue has been marked as a duplicate of h2database/h2database#1841 which has been fixed but not yet released. The problem is a deadlock in H2 when multiple shutdown commands are issued on separate threads. This happens once all the tests have been run and the JVM is exiting. The contexts' shutdown hooks run in parallel and close the contexts which, in turn, shuts down H2. A workaround noted in h2database/h2database#1841 is to use The With Spring Boot versions prior to 2.2, Gradle users can avoid DevTools being on the test runtime classpath by using the recommend configuration: configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
} Unfortunately, there is no equivalent configuration for Maven users. |
I removed the devtools dependency in the branch I use for my upcoming talk, that's why I was not able to reproduce the issue. Thanks for the detailed explanation @wilkinsona and for the devtools improvement @mbhave. |
Hello,
After 2.1.3.RELEASE -> 2.1.4.RELEASE upgrade our tests starts hangs after success execution without any errors on GitLab CI as well as locally with gradle run from ommand line. Running from IDEA still works fine. I cannot see anything unusual from logs, only these lines is available before it hangs after success test execution:
GitLab CI:
same happening if I'm running tests locally with gradle test command
I cannot share code base because of NDA, but we are using WebFlux REST API + WebFluxSecurity on a web layer and H2 in-memory DB together with spring-data-jpa for persistent layer.
after enabling debug mode, I found this repeatable logs from Hikari pool
I'm really not sure what is going wrong. but with spring-boot 2.1.3.RELEASE everything was work correctly...
update 1
I have reduced max-lifetime to 3000 and even to 0:
but it doesn't helped me to solve a problem, so I reduced idle-timeout down to 3 sec:
... and now my tests randomly worked locally but issue still wasn't solved
update 2
Finally I found root cause. It was dev-tools runtime dependency... so I removed it and now test back to normal
Not sure if issue can be closed, seems like additional Gradle jvmargs tuning is required when using DevTools
Regards,
Maksim
The text was updated successfully, but these errors were encountered: