Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puma leaking Temp Files for large payloads #1187

Closed
virgoproz opened this issue Jan 9, 2017 · 4 comments
Closed

Puma leaking Temp Files for large payloads #1187

virgoproz opened this issue Jan 9, 2017 · 4 comments
Labels

Comments

@virgoproz
Copy link

Using a fairly standard Rails 4.2.X, Grape API, Puma stack, Ruby 2.3.1

In production we are seeing a leakage of large temp files containing the request body in clear (POST with large bodies). After a few days we are forced to delete these files manually (or write a hack to delete periodically). Puma should call .unlink or .delete on whatever temp file it decides to create.

@janko
Copy link

janko commented Apr 30, 2017

That's weird, because Puma does unlink created tempfiles, even in case of an error.

However, it seems there are two places where Puma creates tempfiles, in Puma::Server#read_body and in Puma::Client#setup_body, and only the one created by Puma::Client seems to get unlinked. I don't know when does Puma::Server#read_body get called.

@nateberkopec
Copy link
Member

Please reopen if you can reporduce this.

@smcgivern
Copy link
Contributor

Because the unlink call happens in an ensure, it's possible for the tempfile to stick around if the process receives SIGKILL (or the ensure doesn't run for any other reason; this is just the easiest way to explain it) before that happens - say, the request is still in progress.

I created #2613 to cover that case, even if it wasn't the root cause of this issue.

@nateberkopec nateberkopec reopened this Apr 26, 2021
@dentarg
Copy link
Member

dentarg commented Jul 14, 2021

With #2613 merged, I think we can close this again.

@dentarg dentarg closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants