Skip to content

Connection leak happening in supavisor connections #595

@LakhveerChahal

Description

@LakhveerChahal

Bug report

  • [N] I confirm this is a bug with Supabase, not with my own application.
    I'm not aware of the exact RCA, hence can't tell. I've tried SingleConnectionDataSource & PGSimpleDataSource in JDBC, but the issue still persists.
  • [Y] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When connecting to Supavisor in Transaction pooler mode via JDBC (SingleConnectionDataSource or PGSimpleDataSource), the supavisor connections are not being released after calling connection.close(). I kept the suppressClose to false to avoid any connection proxy. After a while, the supavisor connections in grafana reaches to 200 count and application starts throwing below exception:
FATAL: Max client connections reached

On top of this, even if the application server is stopped, the supavisor connection count still remains the same. So, even if there was possibility of having bug in my application code, the connection count should ideally drop to zero when the server is killed.

Expected behavior

Supavisor connection should get released when connection is closed by application code.

Screenshots

Image

System information

  • OS: Linux (Although not applicable)
  • Browser (if applies) Not Applicable
  • Version of supabase-js: hosted on supabase
  • Version of Node.js: Not being used
  • Version of Java: 17

Additional context

References:
SingleConnectionDataSource - https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jdbc/datasource/SingleConnectionDataSource.html
PGSimpleDataSource- https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/PGSimpleDataSource.html

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions