Sending requests one by one is OK, while many requests a time will give no response
Issue Description
I follow the tutorial to setup my own parse-server.
In debug mode, I try to send the requests one by one, it works great, but when I remove the breakpoint and let my app sends many different requests a time , the server will give no response.
Open the server error log, there will be one error says "ParseError { code: 101, message: 'Object not found.' }".
One thing you need to know is that ,this code written with REST API worked well while server hosted by parse.com, I just use the same code to send requests to my own parse server.
Steps to reproduce
- set up parse server on Debian, And Set up mongo database on the same machine.
- send requests one by one, It will be OK
- Send many different requests. For example, first request is that saving one record and do not wait the reply, send another request that querying another record immediately. 4.) Both these two requests will get no response.
Expected Results
Both requests should be answered and give responses.
Actual Outcome
No response
Environment Setup
- Server
- parse-server version: v.2.2.17
- Operating System: Debian 8.0
- Nodejs: v6.3.1
- Hardware: NA
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Linode VPS
- Database
- MongoDB version: v3.2.8
- Storage engine: NA
- Hardware: NA
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): on the same VPS
Logs/Trace
error: Error generating response. ParseError { code: 101, message: 'Object not found.' } code=101, message=Obj ect not found. Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11) at ServerResponse.header (/usr/lib/node_modules/express/lib/response.js:719:10) at ServerResponse.send (/usr/lib/node_modules/express/lib/response.js:164:12) at ServerResponse.json (/usr/lib/node_modules/express/lib/response.js:250:15) at handleParseErrors (/usr/lib/node_modules/parse-server/lib/middlewares.js:248:9) at Layer.handle_error (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/layer.js:71:5) at trim_prefix (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/index.js:310:13) at /usr/lib/node_modules/parse-server/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/index.js:330:12) at next (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/index.js:271:10)
Update: I use the parse-server v2.2.14, this bug will never happen. So I'm sure this bug occurs while code changes after that.
So in general the question is.... Is there any Stable Version?
Try use NGINX as it is better to handle load and requests! Usually if the CPU hits 100% while sending request, any new requests will not be able to find their way to your server it is also useful to tell us which instance type did you use for example on AWS and how many requests/s are you doing
for your error Can't send header ... make sure you are using latest ExpressJS version
I'm also got alot of error code=101, this week i'm promote parse-server to production, and after > 10 request/sec, parse-server stop responding :
info: warning: error while sending push code=101, message=Object not found.
@benishak , Did you try the latest version? Actually I have the latest expressjs version & parse server version. When I rolled back, every thing works well.
yes I'm using Parse Server 2.2.17 and express 4.14.x
Does anyone have a clear list of repro steps?
@hramos The simplest way to trigger this problem is to send requests sequentially in an for loop. The first request actually returns the value but all subsequent values trigger the error mentioned above. Normally such a request should be batched together anyway but it shouldn't show an error message either.
The following code (AndroidSDK) triggers this issue:
for (Token token : tokens) {
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("email", token.getEmail());
query.findInBackground((objects, error) -> {
// second request will return error
});
}
@letzgame @fusion44 can you update to 2.2.23 and tell us if the issue still persists?