Skip to content

Conversation

@jackdingilian
Copy link
Contributor

This makes two related changes to attempt to address #1205

  1. Wrap the generator used for execute query in try-finally and call close in the finally block. This cleans up the instance registration used by ping and warm even when iteration fails or is exited early.

  2. Change the instance registration method so that it does not need to take a reference to the owner. When an iterator is abandoned early, with no error, finally won't run until it is GC'ed. This reference in the registration future prevents GC though. Changing this to take the id and app profile directly resolves the issue.

@jackdingilian jackdingilian requested review from a team as code owners October 3, 2025 18:19
@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Oct 3, 2025
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/python-bigtable API. label Oct 3, 2025
@jackdingilian jackdingilian force-pushed the fix-sql-iterator-leak branch 2 times, most recently from 67adacc to 13653d8 Compare October 3, 2025 18:21
daniel-sanche
daniel-sanche previously approved these changes Oct 3, 2025
Copy link
Contributor

@daniel-sanche daniel-sanche left a comment

Choose a reason for hiding this comment

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

I left a small docstring comment, but LGTM

@jackdingilian jackdingilian force-pushed the fix-sql-iterator-leak branch from 0134705 to 3b58530 Compare October 6, 2025 17:09
@jackdingilian jackdingilian changed the title Fix instance registration cleanup on early iterator termination fix: Fix instance registration cleanup on early iterator termination Oct 6, 2025
@jackdingilian jackdingilian force-pushed the fix-sql-iterator-leak branch from 3b58530 to 9ff2837 Compare October 6, 2025 17:11
@daniel-sanche daniel-sanche added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Oct 6, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 6, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 6, 2025
@daniel-sanche daniel-sanche merged commit bbfd746 into googleapis:main Oct 6, 2025
24 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/python-bigtable API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants