Skip to content

Conversation

@EDsCODE
Copy link
Contributor

@EDsCODE EDsCODE commented Dec 19, 2025

Summary

  • Explicitly detaches DuckLake catalog before closing DuckDB connection
  • Prevents RDS metadata connection leaks when clients disconnect

Problem

When duckgres clients disconnect, the DuckLake extension wasn't releasing its connection to the RDS PostgreSQL metadata store. This caused connection leaks:

SELECT usename, application_name, state, count(*) 
FROM pg_stat_activity 
GROUP BY 1,2,3;

     usename     |    application_name    | state  | count
-----------------+------------------------+--------+-------
 ducklingexample |                        | idle   |   170  -- leaked connections!

Eventually RDS runs out of connection slots:

FATAL: remaining connection slots are reserved for roles with privileges of the "rds_reserved" role

Solution

Run DETACH ducklake before db.Close() when a client disconnects. This ensures the DuckLake extension properly closes its RDS connection.

Test plan

  • Build succeeds
  • All tests pass
  • Deploy and verify RDS connection count stays stable

🤖 Generated with Claude Code

When a client disconnects, explicitly DETACH the ducklake catalog before
closing the DuckDB connection. This ensures the DuckLake extension properly
releases its connection to the RDS metadata store, preventing connection leaks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@EDsCODE EDsCODE merged commit 60e3180 into main Dec 19, 2025
7 checks passed
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