Repository navigation
Conversation
HikariCheckpointRestoreLifecycle is a plain Lifecycle, so it is stopped whenever the application context is closed, not only before a checkpoint. When pool suspension is allowed, stop() suspends the pool before beans are destroyed. A bean that borrows a connection while it is being destroyed, for example when Hibernate drops the schema with ddl-auto=create-drop, then waits forever as HikariCP blocks without a timeout while the pool is suspended. This commit leaves the pool alone when the context is being closed as the data source is closed during bean destruction anyway. See spring-projectsgh-52276 Signed-off-by: Challa Srinivasa Reddy <challa.srinivasareddy@gmail.com>
challa
force-pushed
the
gh-hikari-no-suspend-on-close
branch
from
October 17, 2026 11:06
3d5fb20 to
3b7c803
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HikariCheckpointRestoreLifecycleis a plainLifecycle, so itsstop()method is called whenever the application context is closed, not only before a checkpoint. Withspring.datasource.hikari.allow-pool-suspension=true, which the lifecycle's warning asks for whenorg.cracis on the classpath,stop()suspends the pool before beans are destroyed. A bean that borrows a connection while it is being destroyed then blocks forever, as HikariCP'sSuspendResumeLockusesSemaphore.acquireUninterruptibly()while the pool is suspended.For example, with Hibernate and an embedded database, where
ddl-autodefaults tocreate-drop, the schema is dropped when theEntityManagerFactoryis closed andcontext.close()never returns:The same application closes normally with
allow-pool-suspension=false.This change makes
stop()return early when the context is being closed, as the data source is closed during bean destruction anyway. The warning about pool suspension was already skipped in that case, so its own check is no longer needed. The new test inHikariCheckpointRestoreLifecycleTestsfails without the change.One case this doesn't cover: if the context is stopped, which suspends the pool, and then closed without being started again, the lifecycle is no longer running at close so the pool remains suspended. I wasn't sure whether that's something you'd want handled, so I've left it out.
I used an AI coding assistant for parts of the analysis; I reviewed and verified the change and tests myself.