-
Notifications
You must be signed in to change notification settings - Fork 10.4k
LOH fragmentation when user post form with section content more than 85KB #2720
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
Comments
From @sajayantony on Friday, March 25, 2016 3:27:48 PM @yuwaMSFT Does the LOH fragmentation cause OOM or crash? |
From @Tratcher on Friday, March 25, 2016 3:33:59 PM Related: aspnet/HttpAbstractions#583 |
From @yuwaMSFT on Friday, March 25, 2016 3:35:02 PM It causes the memory to accumulate. At some point it will cause OOM (and the app would crash on exception of memory allocation or killed by OOM killer before that happens).
|
From @blowdart on Saturday, March 26, 2016 5:29:12 AM Ouchie :( And I think you're right, this is certainly a potential DoS concern (as is 583) |
From @blowdart on Tuesday, April 5, 2016 2:50:12 PM Yes. If it's spiking memory so badly the app pool will recycle then it's a DoS |
From @yuwaMSFT on Wednesday, July 6, 2016 10:53:32 AM I checked the latest code. It seems to still have the same issue for multipart form data content. |
I don't think the object model gives us any choice here, we're supposed to render form fields as strings. There's no way to split up a string to keep it under the LOH limit. Yes these LOH strings can cause a memory spike, but they should still be collected by GC before an actual OOM. Has anyone here actually experienced an OOM? The MultipartBodyLengthLimit (128mb) and the server's request body size limit (30mb) can both be used to mitigate this if you're not expecting large bodies. The alternative is to read the form directly using the MutiplartReader. I recommend closing this. |
We should make sure we document that large file uploads are unsuitable with the existing API (I believe we do call that out a little). |
From @yuwaMSFT on Friday, March 25, 2016 3:24:48 PM
Post a multipart form with content more than 85KB in each section would cause heavy LOH fragmentation in MVC app.
Post a multipart form with 100 sections, each containing random sized content with an average of 120KB.
After the first request:
After the 2nd request:
After the 3rd request:
So for each request we are adding the large string in LOH for each section (field) of the form. Also, look at the "Free" type. They are mostly 30 bytes in LOH accompany each large string. It may be some string interning.
For the string object, basically we are reading each section (field) into a string:
This can be easily explored to cause the server to run OOM. Security concern as well.
Copied from original issue: aspnet/HttpAbstractions#597
The text was updated successfully, but these errors were encountered: