parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Sending requests one by one is OK, while many requests a time will give no response

Open letzgame opened this issue 10 years ago • 10 comments

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

  1. set up parse server on Debian, And Set up mongo database on the same machine.
  2. send requests one by one, It will be OK
  3. 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)

letzgame avatar Aug 14 '16 03:08 letzgame

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.

letzgame avatar Aug 14 '16 07:08 letzgame

So in general the question is.... Is there any Stable Version?

kwstasna avatar Aug 14 '16 19:08 kwstasna

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

benishak avatar Aug 16 '16 08:08 benishak

for your error Can't send header ... make sure you are using latest ExpressJS version

benishak avatar Aug 16 '16 08:08 benishak

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.

si294r avatar Aug 18 '16 22:08 si294r

@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.

letzgame avatar Aug 21 '16 08:08 letzgame

yes I'm using Parse Server 2.2.17 and express 4.14.x

benishak avatar Aug 22 '16 14:08 benishak

Does anyone have a clear list of repro steps?

hramos avatar Sep 06 '16 20:09 hramos

@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
    });
}

fusion44 avatar Sep 28 '16 17:09 fusion44

@letzgame @fusion44 can you update to 2.2.23 and tell us if the issue still persists?

flovilmart avatar Oct 22 '16 04:10 flovilmart