Comments (4)
We have to buffer the entire request in order to prevent slow network
clients from stalling the wsgi worker threads. However, the current
situation is not ideal.
I think it needs to be possible to configure a max request size for the
wsgi handler, which will reject an incoming request with the appropriate
status code if it's above the allowed size. Setting it to a default value
of 100MB or so would seem to mitigate malicious attacks while still
allowing most sensible files through.
Sound reasonable?
On Thu, 3 Mar 2016 at 22:42, Marcel Hellkamp [email protected]
wrote:
The WSGI adapter reads the complete request body into memory. This results
in extreme memory consumption for large file uploads and makes it very easy
to run denial-of-service attacks.curl --data-binary "@/dev/zero" http://example.com/wsgi
—
Reply to this email directly or view it on GitHub
#7.
from aiohttp-wsgi.
Stalling the worker thread pool is always better than exhausting the server memory. It brings down only the WSGI application, not the whole server.
With a hard per-request limit, you could still get the server into swapping with multiple smaller requests. Also, uploading bigger files would no longer be possible.
Why not buffer into a reasonably sized tempfile.SpooledTemporaryFile
, chunk by chunk? Then, a maximum of memory_limit_per_tempfile * thread_pool_size
of memory is used and bigger requests are still allowed. Bottle does it this way.
from aiohttp-wsgi.
A spoiled temporary file seems good too, but I think a max upload size is
still sensible. Most webservers have this built in. Nginx limits to 5MB by
default, I think, which is tiny!
On Fri, 4 Mar 2016 at 11:08, Marcel Hellkamp [email protected]
wrote:
Then you could still get the server into swapping with multiple smaller
requests. Also, uploading bigger files would no longer be possible. Why not
buffer into a reasonably sized tempfile.SpooledTemporaryFile, chunk by
chunk?Other than that, stalling the worker thread pool is still better than
exhausting the server memory. It brings down only the WSGI application, not
the whole server.—
Reply to this email directly or view it on GitHub
#7 (comment).
from aiohttp-wsgi.
Here we go: https://github.com/etianen/aiohttp-wsgi/blob/master/CHANGELOG.rst#040
from aiohttp-wsgi.
Related Issues (18)
- What's the benefit for aiohttp-wsgi + django? HOT 2
- aiohttp-wsgi on heroku HOT 5
- [Django] bug with cyrillic chars in URL HOT 3
- Need a version compatible with aiohttp>=2 HOT 2
- Serving WSGI app from Python code HOT 6
- Option to instruct aiohttp-wsgi to not touch logging HOT 3
- Update to aiohttp 3+ HOT 2
- Runtime error using Django HOT 1
- Flask + ProcessPoolExecutor -> TypeError: can't pickle _thread.lock objects HOT 2
- Version of Python HOT 1
- TypeError: handle_request() takes 2 positional arguments but 3 were given HOT 2
- EnvironTest.testEnviron fails with aiohttp 3.8.1 HOT 2
- "socket.send() raised exception." HOT 7
- Improper "unquoting" HOT 2
- Deployment instructions...? HOT 3
- Please provide support for aiohttp 0.22 HOT 2
- Running under multiple processes? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiohttp-wsgi.