8000 codefix: close varFile when checkpoint save by hauntedness · Pull Request #503 · gomlx/gomlx · GitHub
[go: up one dir, main page]

Skip to content

codefix: close varFile when checkpoint save - #503

Merged
janpfeifer merged 1 commit into
gomlx:mainfrom
hauntedness:resource_leak_fix
Nov 28, 2026
Merged

janpfeifer merged 1 commit into
gomlx:mainfrom
hauntedness:resource_leak_fix

Conversation

@hauntedness
Copy link
Copy Markdown
Contributor

In ml/model/checkpoint/checkpoint.go, getSaveVarFiles previously returned a *gzip.Writer directly for gzip-formatted checkpoints. Because gzip.Writer.Close() does not close its underlying io.Writer (*os.File), the checkpoint file handle was leaked after Save() completed. On Windows, this leaves the file locked and prevents subsequent deletion or cleanup.

@janpfeifer
Copy link
Copy Markdown
Contributor

Thanks! I never realized that gzip.Writer.Close() didn't close the underlying writer it was created on.

@janpfeifer
janpfeifer merged commit 0841e82 into gomlx:main Nov 28, 2026
4 checks passed
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

0