Skip to content

Parse-Server Crash on APNs Timeout #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
doodyparizada opened this issue Mar 15, 2017 · 3 comments
Closed

Parse-Server Crash on APNs Timeout #66

doodyparizada opened this issue Mar 15, 2017 · 3 comments

Comments

@doodyparizada
Copy link

Transferred from parse-community/parse-server#3637

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.

@tylerarnold
Copy link

I see the same behavior. It would be far nicer to properly catch the error and not blow up.

@woodardj
Copy link

Same. We just had a cert expire and it crashes the whole app. Pretty bad failure mode.

@flovilmart
Copy link
Contributor

And as mentioned many times, we won’t fix this one. This is inside the node APN module, feel free to open an issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants