Skip to content

Initialize tempfiles and store temp files#423

Open
oxycoder wants to merge 1 commit intolocomotivecms:masterfrom
oxycoder:patch-1
Open

Initialize tempfiles and store temp files#423
oxycoder wants to merge 1 commit intolocomotivecms:masterfrom
oxycoder:patch-1

Conversation

@oxycoder
Copy link
Copy Markdown

@oxycoder oxycoder commented Mar 9, 2026

Issue:

Tempfile.new(...).tap { ... } in precompile returns the Tempfile with no stored reference. Ruby's GC finalizer deletes the temp file before checksum can read it. This is especially likely with large files like bundle.js since they trigger GC during memory allocation.

The fixes added @TempFiles ||= [] and @TempFiles << file to hold a strong reference to each Tempfile for the lifetime of the push command object, preventing GC from deleting them.

added @TempFiles ||= [] and @TempFiles << file to hold a strong reference to each Tempfile for the lifetime of the push command object, preventing GC from deleting them.
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.

1 participant