How a Spring @Transactional Misuse Exhausted Database Connections via External I/O
A production incident traced a Hikari connection pool exhaustion to a Spring @Transactional method that enclosed synchronous calls to external systems like ActiveMQ, Firebase, S3, and SMS. Spring's default event listeners run synchronously on the publishing thread, meaning JDBC connections stayed checked out from the pool during network round-trips to the message broker. When the ActiveMQ broker became unavailable, every write request stalled on the JMS send, preventing transactions from committing and draining the pool entirely. New requests then timed out after 30 seconds, surfacing as SQLTransientConnectionException errors. The root cause was a code pattern where database transaction boundaries incorrectly enclosed calls to external systems that the database had no visibility into.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in