Skip to content

Return the connection when withConnection throws - #1767

Open
sharanggupta wants to merge 1 commit into
eclipse-vertx:masterfrom
sharanggupta:pool-with-connection-throwing-function
Open

sharanggupta wants to merge 1 commit into
eclipse-vertx:masterfrom
sharanggupta:pool-with-connection-throwing-function

Conversation

@sharanggupta

Copy link
Copy Markdown

When the function given to Pool.withConnection throws instead of returning a failed future, the connection was never returned to the pool, unlike withTransaction. The exception now fails the returned future and the connection is closed as usual. The test runs against PostgreSQL with a pool of one connection.

A function that threw instead of returning a failed future left the
connection borrowed for good, unlike withTransaction.

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Assisted-by: Anthropic Claude (claude-opus-5-5)
@vietj vietj added this to the 5.3.0 milestone Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants