Skip to content

Return the connection when withConnection throws - #1767

Merged
tsegismont merged 1 commit into
eclipse-vertx:masterfrom
sharanggupta:pool-with-connection-throwing-function
Nov 12, 2026
Merged

tsegismont merged 1 commit into
eclipse-vertx:masterfrom
sharanggupta:pool-with-connection-throwing-function

Conversation

@sharanggupta

Copy link
Copy Markdown
Contributor

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.

@vietj vietj added this to the 5.3.0 milestone Oct 29, 2026
@tsegismont tsegismont added the bug label Nov 12, 2026
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)
@tsegismont
tsegismont force-pushed the pool-with-connection-throwing-function branch from 3f72426 to 102a5d3 Compare November 12, 2026 16:20

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @sharanggupta

@tsegismont
tsegismont merged commit 50aaa8a into eclipse-vertx:master Nov 12, 2026
20 checks passed
tsegismont added a commit that referenced this pull request Nov 12, 2026
A function that threw instead of returning a failed future left the
connection borrowed for good, unlike withTransaction.

Assisted-by: Anthropic Claude (claude-opus-5-5)


(cherry picked from commit 50aaa8a)

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Sharang Gupta <sharang@sharanggupta.dev>
tsegismont added a commit that referenced this pull request Nov 12, 2026
A function that threw instead of returning a failed future left the
connection borrowed for good, unlike withTransaction.

Assisted-by: Anthropic Claude (claude-opus-5-5)


(cherry picked from commit 50aaa8a)

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Sharang Gupta <sharang@sharanggupta.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants