Prevent the DS from crashing when an app abuse the requests
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
#183 is similar