Skip to content

fix: close the connection null_absent_columns opens - #1916

Merged
abrignoni merged 1 commit into
mainfrom
fix/null-absent-columns-close
Aug 9, 2026
Merged

fix: close the connection null_absent_columns opens#1916
abrignoni merged 1 commit into
mainfrom
fix/null-absent-columns-close

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

null_absent_columns opens a connection through open_sqlite_db_readonly to compile the query with EXPLAIN, and returns without closing it. Artifacts call it once per query, and it is now wired into 534 call sites in this repo, so this is one held handle per query for the length of a run rather than a one-off.

Same class as the three does_*_exist_in_db helpers fixed in #1778, which this function postdates.

Measured, by counting open file descriptors

Garbage collection disabled so a leak cannot be hidden by collection:

before after
150 null_absent_columns calls +150 open fds +0

Behaviour is unchanged: the same query still returns with the absent column reported as NULL under its own name.

A ResourceWarning-based test was tried first and is not adequate. That warning is raised during garbage collection, where CPython prints "Exception ignored" rather than propagating, so the test reported "no leak" against the unfixed code too. Descriptor counting was confirmed to fail on the unfixed version before being trusted.

Levelled to the other four cores: ALEAPP #1081, DLEAPP #61, RLEAPP #401, VLEAPP #118. Those also carry the #1778 helper fixes, which had not reached them.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

It opens a connection through open_sqlite_db_readonly to compile the query and
returns without closing it. Artifacts call it once per query, so this is one
held handle per query for the length of a run rather than a one-off, and it is
now wired into 534 call sites here.

Measured by counting open file descriptors with gc disabled: 150 calls leaked
150 handles before, 0 after. Behaviour unchanged.

Companion to #1778, which fixed the same class in the three does_*_exist_in_db
helpers and predates this function.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit 27fd545 into main Aug 9, 2026
6 checks passed
@abrignoni
abrignoni deleted the fix/null-absent-columns-close branch August 9, 2026 19:52
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.

1 participant