Skip to content
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

maxCreateConnectionTime may cause connection leak #165

Closed
patriknw opened this issue May 13, 2022 · 2 comments
Closed

maxCreateConnectionTime may cause connection leak #165

patriknw opened this issue May 13, 2022 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@patriknw
Copy link
Contributor

Bug Report

Versions

  • Driver: r2dbc-postgres
  • Database: Postgres
  • Java: JDK 11
  • OS:

Current Behavior

More connections than max and connections are not closed if maxCreateConnectionTime is defined.

Steps to reproduce

Set a small maxCreateConnectionTime that causes timeout. Look in database for open connections:

SELECT * FROM   pg_stat_activity;

Expected behavior/code

No connection leak.

Possible Solution

I think the underlying connection can still be established but not added to the pool, or closed. The maxCreateConnectionTime is only a timeout on the Mono.

I suggest to remove maxCreateConnectionTime and let users define the timeout with ConnectionFactoryOptions.CONNECT_TIMEOUT.

I don't know if maxAcquireTime can cause something similar.

@mp911de
Copy link
Member

mp911de commented Jun 22, 2022

It is possible that the timeout operator cancels the connection creation but the connection was partially established. In that case, the timeout operator drops the connection but we never close it on our side. That's something we need to fix.

@mp911de mp911de added the type: bug A general bug label Jun 23, 2022
mp911de added a commit that referenced this issue Jun 23, 2022
We now close connections that were dropped because of the creation timeout but still emitted to prevent connection leaks.

[resolves #165]

Signed-off-by: Mark Paluch <[email protected]>
mp911de added a commit that referenced this issue Jun 23, 2022
We now close connections that were dropped because of the creation timeout but still emitted to prevent connection leaks.

[resolves #165]

Signed-off-by: Mark Paluch <[email protected]>
@mp911de mp911de added this to the 0.9.1.RELEASE milestone Jun 23, 2022
@mp911de
Copy link
Member

mp911de commented Jun 23, 2022

That's fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants