Skip to content

test framework: close download tempfile before extracting tarball - #745

Merged
unnawut merged 1 commit into
leanEthereum:mainfrom
unnawut:fix/download-keys-buffer-flush
May 21, 2026
Merged

test framework: close download tempfile before extracting tarball#745
unnawut merged 1 commit into
leanEthereum:mainfrom
unnawut:fix/download-keys-buffer-flush

Conversation

@unnawut

@unnawut unnawut commented May 21, 2026

Copy link
Copy Markdown
Collaborator

🗒️ Description

Prod key extraction on latest main branch is failing because the previous flow held the temp file open while tarfile reopened the same path with a separate file descriptor. So there's chance that the tar file content was not fully written before it's being decompressed.

The new code closes the temp-file write context before opening it again for reading, so the kernel sees the full tarball on disk.

The previous flow held the temp file open while tarfile reopened the same
path with a separate file descriptor. Any tail still in Python's userspace
BufferedWriter was invisible to the reader, surfacing as a near-end gzip
EOFError that looked like a truncated download.

Reproduces deterministically on Python 3.14.5 against the current 152 MB
prod_scheme.tar.gz; ~24 KB of the gzip trailer was stranded in the buffer.

Restructure download_keys to reserve the temp path, write through a
dedicated open()/close() context, then open the closed file for extraction.
@unnawut
unnawut requested a review from tcoratger May 21, 2026 09:08
@unnawut unnawut added the framework Scope: Changes to the testing framework label May 21, 2026
@unnawut

unnawut commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

Merging without approval since this has low side effect

@unnawut
unnawut merged commit 825bec6 into leanEthereum:main May 21, 2026
13 checks passed
@unnawut
unnawut deleted the fix/download-keys-buffer-flush branch May 21, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework Scope: Changes to the testing framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant