Skip to content

Fix too-many-open-files leak in availability worker and version lookup - #21

Merged
pdmars merged 2 commits into
mainfrom
bug/too-many-open-files
Aug 12, 2026
Merged

pdmars merged 2 commits into
mainfrom
bug/too-many-open-files

Conversation

@pdmars

@pdmars pdmars commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

or at least an attempt to fix...

@pdmars
pdmars requested a review from msherman64 August 12, 2026 16:37
Comment on lines +39 to +40
if client is None:
client = BlazarClient(cloud_name)

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.

good fix, I think there's a longstanding footgun where openstack "connection" objects aren't garbage collected.

def get_version(repo_root: Path) -> Optional[str]:
"""Gets the repository version for a given repo_root."""
return filesystem.get_version(repo_root)
return filesystem.get_release_and_timestamp(repo_root).get("version")

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.

I'm not sure exactly what this change does?

In the old path, it calls git_versioning.get_version(), which creates a new Repo() object on each call

and in the new path, it's calling get_release_and_timestamp, which also creates a new Repo on each call, but has a @cached decorator, so I guess it should reuse that cached object.

is that the only difference?

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.

it seems like nothing else calls git_versioning.get_version() after this, so we can probably just remove that method too.

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.

it looks like the other methods (list_versions, get_version_info) also use the same cache, but could be distinct per site/node, and fill the cache up?

we might want to use a different cache for the get_release_and_timestamp because it depends only on the repo_path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good points.

  1. yes main reason was to use the cache
  2. good catch, removed
  3. good point, moved it to its own cache

@pdmars
pdmars merged commit 82d7e92 into main Aug 12, 2026
3 checks passed
@pdmars
pdmars deleted the bug/too-many-open-files branch August 12, 2026 18:08
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