Skip to content

Fix zombie $partitions queries left running by SQLAlchemy reflection - #627

Merged
hashhar merged 1 commit into
trinodb:masterfrom
hashhar:hashhar/fix-sqlalchemy-partitions-zombie-query
Aug 21, 2026
Merged

Fix zombie $partitions queries left running by SQLAlchemy reflection#627
hashhar merged 1 commit into
trinodb:masterfrom
hashhar:hashhar/fix-sqlalchemy-partitions-zombie-query

Conversation

@hashhar

@hashhar hashhar commented Aug 14, 2026

Copy link
Copy Markdown
Member

Description

_get_partitions never closes the query result after reading cursor.description, so the underlying query is never cancelled and lingers on the coordinator until it eventually times out on its own. Close the result in a finally block so it's always cancelled, whether or not reading cursor.description succeeds.

Non-technical explanation

Supersedes #608

Release notes

( ) This is not user-visible or docs only and no release notes are required.
(x) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot Bot added the cla-signed label Aug 14, 2026
@hashhar
hashhar force-pushed the hashhar/fix-sqlalchemy-partitions-zombie-query branch from 543b977 to 97597a8 Compare August 20, 2026 15:27
Comment thread tests/integration/test_sqlalchemy_integration.py Outdated

@azawlocki-sbdt azawlocki-sbdt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, except for one minor comment re the docstring of an aux function used only in tests

_get_partitions never closes the query result after reading
cursor.description, so the underlying query is never cancelled and
lingers on the coordinator until it eventually times out on its own.
Close the result in a finally block so it's always cancelled, whether
or not reading cursor.description succeeds.

Co-authored-by: viniolivieri <vinicius.olivieri@jampp.com>
@hashhar
hashhar force-pushed the hashhar/fix-sqlalchemy-partitions-zombie-query branch from 97597a8 to 8fa5d94 Compare August 21, 2026 12:28
@hashhar
hashhar merged commit 5b662be into trinodb:master Aug 21, 2026
11 checks passed
@hashhar
hashhar deleted the hashhar/fix-sqlalchemy-partitions-zombie-query branch August 21, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants