-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
Files parsed by IncomingForm().parse
are not automatically cleaned up or deleted.
#967
Comments
form.parse
are not automatically cleaned up or deleted.IncomingForm().parse
are not automatically cleaned up or deleted.
Files are not removed |
Can you help me understand how keeping files on disk means it's necessary to keep the data in memory? Keeping files seems super reasonable. Keeping things in memory seems somewhat less reasonable. |
@bensonk In this case, I believe the reason is that the files are stored in memory as an artifact of the host (Cloud Run). @GrosSacASac Is this working as intended, then, or is this a bug? If it's working as intended, the examples should probably be updated so that they clean up the files when they're done, because if not I imagine that a lot of your users made the same mistake and are experiencing this same disk space or memory leak situation without knowing it. |
If I upload a file I want it to stay |
Ok, I see that the behavior is documented: https://github.com/node-formidable/formidable/blob/master/README.md#highlights I was text searching for different terms. From the perspective of my pipeline which consumes but has no need to store the files, this behavior is surprising but I can see how it would make sense from a different perspective. |
They are not automatically cleaned up, yeah. That's a user-land thing. There's not-writing-to-disk option and you should use it instead. (fileWriteStreamHandler) I don't see it necessarily as memory leak or anything. But good point, maybe we should document it. |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
Parsed files are not cleaned up automatically and lead to a memory leak in production.
I couldn't find this behavior documented anywhere, so I'm unsure whether it's expected behavior that needs to be documented or whether it's a bug and parsed files should be deleted automatically.
What was the result you got?
The effect is best seen in the production graphs.
You can see the container reboot due to an out-of-memory killer on the left, then you can see a reboot where I attempted to fix the leak by adding the
jsonStream.destroy()
logic, and then finally the noted fix where I usefs.unlink
to delete the files emitted byform.parse
.What result did you expect?
I expected that the parsed files would be automatically cleaned up when
form
orformfields
went out of scope. I have to use additional logic to separately delete them or a memory leak occurs.The text was updated successfully, but these errors were encountered: