HYP-225 (fix) close handler database connections after ui endpoint calls#1202
HYP-225 (fix) close handler database connections after ui endpoint calls#1202Divyanshu-Patel wants to merge 2 commits into
Conversation
The FastAPI server's /auth, /check, and /metadata endpoints call handler.load() which creates database connections, but never close them after the operation completes. This causes idle sessions to linger on the customer's database server for hours. Added _close_handler_client() that disposes the handler's sql_client after each UI endpoint call. Uses hasattr checks so it's safe for non-SQL handlers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📜 Docstring Coverage ReportRESULT: PASSED (minimum: 30.0%, actual: 80.0%) Detailed Coverage Report |
📦 Trivy Vulnerability Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtVulnerabilities
uv.lockVulnerabilities
|
📦 Trivy Secret Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtuv.lock |
|
🛠 Docs available at: https://k.atlan.dev/application-sdk/fix/close-handler-connections-after-ui-endpoints |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
There was a problem hiding this comment.
Pull request overview
Closes handler-backed SQL clients after FastAPI UI endpoint calls to prevent idle database sessions persisting on customer databases (HYP-225).
Changes:
- Added
_close_handler_client()helper to close/dispose handlersql_client. - Invoked cleanup in
finallyblocks for/auth,/check, and/metadataendpoint handlers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🛠 Full Test Coverage Report: https://k.atlan.dev/coverage/application-sdk/pr/1202 |
|
v3 relevance check: |
summary
close handler's sql_client after each ui endpoint call (/auth, /check, /metadata) to prevent idle database sessions from lingering on customer sql server
the fastapi server's endpoints call handler.load() which creates database connections via sql_client, but never close them after the operation completes.
this causes idle sessions to linger on the customer's database server for hours (reported by Bancorp — HYP-225).
fix
added _close_handler_client() helper that disposes the handler's sql_client in a finally block after each endpoint call. uses hasattr checks so it's safe for non-sql handlers.