Saving large files crashes server
Saving a large file (eg:608MB) crashes the server. Looks like after uploading to postgres, the subsequent query tries to allocate twice the memory of the file and it fails
2021-07-31T02:49:33.554Z [error] : "select "files".* from "files" where "files"."id" in ($1) - invalid memory alloc request size 1277113519" DBError: select "files".* from "files" where "files"."id" in ($1) - invalid memory alloc request size 1277113519
at async saveFn (.../bcms/node_modules/@pubsweet/base-model/src/index.js:165:23)
Expected behaviour
Uploading a large file crashes server
Current behaviour
server shouldn't crash
Steps to reproduce
- get a large file (such as a 608MB zip)
- upload to source
- review logs
Environment
[Provide browser name and version and if you're working from a PC or Mac]
Possible solution
Figure out if its possible to not allocate twice the memory of the requested query result