We’re observing really strange behaviour in Parse-server.
It works perfectly between 10:30am and around 3:30 pm and again from midnight to 7:30 am.
By that I mean the we get close to 200,000 - 900,000 logs per half an hour in those timeperiods,
however in the time period it’s not working the numbers drop to only 20,000 odd
In between the time it doesn’t work we keep getting the following errors -
Nginx reverse proxy -
[error] 1107#0: *20723 recv() failed (104: Connection reset by peer) while reading response header from upstream, client
Parse server throws the following error -
{"name":"MongoError","level":"error","message":"Uncaught internal server error. Cannot use a session that has ended","stack":"MongoError: Cannot use a session that has ended\n at applySession (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/sessions.js:695:12)\n at _command (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/wireprotocol/command.js:58:17)\n at command (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/wireprotocol/command.js:28:5)\n at writeCommand (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/wireprotocol/write_command.js:47:3)\n at Object.insert (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/wireprotocol/index.js:6:5)\n at Connection.insert (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/cmap/connection.js:187:8)\n at /usr/lib/node_modules/parse-server/node_modules/mongodb/lib/core/sdam/server.js:483:13\n at Object.callback (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/cmap/connection_pool.js:345:7)\n at processWaitQueue (/usr/lib/node_modules/parse-server/node_modules/mongodb/lib/cmap/connection_pool.js:468:23)\n at /usr/lib/node_modules/parse-server/node_modules/mongodb/lib/cmap/connection_pool.js:261:28","timestamp":"2021-04-12T08:00:32.083Z"}
This leads to a 502 gateway timeout after about a minute.
Our architecture is -
parse-sdk on a mobile app
AWS Application Load Balancer
Nginx Reverse Proxy
Parse-server
Mongodb
ELK stack
Our parse-servers are in an Auto Scaling Group with a minimum of 2 instances running constantly.
If someone could help with this issue it would be a huge help.
If anymore details are needed please let me know