Skip to content

Close cached readers when exiting an open_files context - #2131

Open
betacatsling wants to merge 1 commit into
fsspec:masterfrom
betacatsling:fix/cached-openfiles-close
Open

Close cached readers when exiting an open_files context#2131
betacatsling wants to merge 1 commit into
fsspec:masterfrom
betacatsling:fix/cached-openfiles-close

Conversation

@betacatsling

Copy link
Copy Markdown

Exiting an open_files context leaves simplecache and filecache readers open because open_many() returns handles without populating the OpenFile wrappers. Close those handles on exit, including when the consumer raises an exception.

Regression coverage exercises both cache implementations, normal and exceptional exits, and cold and warm cache reads. The four regressions fail on the unchanged base and pass with the fix. Local validation: cached-filesystem and core suites 137 passed, 37 skipped; Ruff lint/format and git diff --check passed. Remote backends and downstream suites were not run.

AI assistance was used for implementation and local verification.

Fixes #2130.

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.

Cached open_files readers remain open after context exit

1 participant