Skip to content

Parse-Server Crash on APNs Timeout #3637

Closed
@doodyparizada

Description

@doodyparizada

Issue Description

Using the REST endpoint for sending APNS push, sometimes the service times out and causes parse-server to crash...

Steps to reproduce

Just running this following curl a few times until the app crashes:

curl -H 'X-Parse-Application-Id: XXX' \
     -H 'X-Parse-Master-Key: XXX' \
     -d '{"where": {"user": {"$inQuery": {"className": "_User", "where": {"objectId": {"$in": ["UID1", "UID2"]}}}}}, "data": {"title": "my title", "alert": "mi alert"}}' \
     'http://localhost:1337/parse/push'

Expected Results

parse-server should catch the exception and either retry or fail with an error message (not crash the whole process).

Actual Outcome

parse-server is crashing on:

/parse/node_modules/parse-server/lib/ParseServer.js:401
            throw err;
            ^

Error: Connect timed out
    at Connection.<anonymous> (/parse/node_modules/apn/lib/connection.js:226:36)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

Environment Setup

  • Server

    • parse-server version: 2.2.22
    • Operating System: ubuntu 14.04
    • Hardware: AWS t2.medium
    • Localhost or remote server?: AWS
  • Database

    • MongoDB version: 3.0.9
    • Storage engine: S3
    • Hardware: Ubuntu 14.04
    • Localhost or remote server?: ObjectRocket

Logs/Trace

I caught two types of crashes:

ERR! parse-server-push-adapter APNS cannot find vaild connection for b73bd323f4e1a5427a82e2463c79e0b9cb34f95e8154e78ce7a2511021282ec5
/parse/node_modules/parse-server/lib/ParseServer.js:401
            throw err;
            ^

Error: certificate has expired: 2017-03-09T07:49:49.000Z
    at validateCredentials (/parse/node_modules/apn/lib/credentials/validate.js:12:9)
    at /parse/node_modules/apn/lib/connection.js:163:5
    at _fulfilled (/parse/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/parse/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/parse/node_modules/q/q.js:796:13)
    at /parse/node_modules/q/q.js:604:44
    at runSingle (/parse/node_modules/q/q.js:137:13)
    at flush (/parse/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

But my certificate is not expired - retrying works.

and:

/parse/node_modules/parse-server/lib/ParseServer.js:401
            throw err;
            ^

Error: Connect timed out
    at Connection.<anonymous> (/parse/node_modules/apn/lib/connection.js:226:36)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

just timing out on the connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions