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.
As far as I understand, what happens here is that if we try to upload a too big file that exceeds the whole app JVM memory (maybe we even should use
getRuntime().totalMemory()
instead of.maxMemory()
here - not sure),then (despite that I tried as you see to buffer writing in the fileService - it does not help, I'm not sure if I should revert it as it was or is it still better than writing it all in the sink in one go?) the system starts urgently shutdown everything, and we can't even catch this OOM error bc there's nothing left that can catch it, so to speak :)
So here I'm making this file size check before we even start.
Combined with this user-friendly file size limit PR I think we're probably good. That linked PR has temporary hard-coded limitation according to our current BE requirements + user-friendly error handling.