Repository navigation
fix(datasets): close file handle on VideoDecoder init failure in cache - #3542
Merged
CarolinePascal merged 1 commit intoMay 10, 2026
Merged
Conversation
If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
CarolinePascal
approved these changes
May 10, 2026
CarolinePascal
left a comment
Collaborator
There was a problem hiding this comment.
Good catch, thank you !
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
May 12, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
DannyHan-1124
pushed a commit
to DannyHan-1124/lerobot
that referenced
this pull request
May 26, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
Jun 4, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
Jun 4, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
Jun 4, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
Jun 10, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
jogarulfo
pushed a commit
to spectrobot-project/spectrobot
that referenced
this pull request
Jun 10, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
wddler
pushed a commit
to wddler/lerobot
that referenced
this pull request
Aug 4, 2026
huggingface#3542) If VideoDecoder() raises during initialization, the fsspec file handle was leaked since it was opened via __enter__() but never closed on the exception path. Now explicitly closes the handle before re-raising.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
VideoDecoderCache.get(), ifVideoDecoder()raises during initialization (e.g., corrupted video file, unsupported codec), the fsspec file handle opened via__enter__()is never closed, causing a resource leak.Added try/except to close the handle before re-raising.
Test plan