cozy-data-system icon indicating copy to clipboard operation
cozy-data-system copied to clipboard

Prevent the DS from crashing when an app abuse the requests

Open aenario opened this issue 9 years ago • 1 comments

So, this was caused by emails, which in some instances would ask the DS for messages/xxx?include_docs=true&keys=[10000keys]

We can all agree this is a bug within emails, which will be fixed. However, the DS should never crash, even if an app is being so rude :smiling_imp: Note : the crash was sometime caused by Allocation Failed (node.js error), sometime by the OOM, so we need to proactively prevent this error and not just catch & react.

2 Options : A - Use streaming JSON Parsing / Permission management / JSON Writing so the whole request's results doesn’t need to be held in memory B - Choose some heuristic (maybe 1000 docs at once, maybe 100Mo of results) at which point the DS should just return a 413 to the app and abort its request to couchdb.

This change is not urgent, filing as Enhancement

aenario avatar Feb 01 '16 10:02 aenario

#183 is similar

nono avatar Feb 01 '16 17:02 nono