parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
87 stars 99 forks source link

warning: error while sending push RangeError: Maximum call stack size exceeded #19

Closed flovilmart closed 2 years ago

flovilmart commented 8 years ago

Initiale posted by @fabuhelow on https://github.com/parseplatform/parse-server/issues/1966

Hi All,

I'm trying to push a new notification to "140,000" users and I have got the following exception:

index-3 (out): info: warning: error while sending push RangeError: Maximum call stack size exceeded index-3 (out): at GCM.send (/parse-server-gcm/node_modules/parse-server-push-adapter/lib/GCM.js:51:42) index-3 (out): at _loop (/parse-server-gcm/node_modules/parse-server-push-adapter/lib/ParsePushAdapter.js:114:38) index-3 (out): at ParsePushAdapter.send (/parse-server-gcm/node_modules/parse-server-push-adapter/lib/ParsePushAdapter.js:120:9) index-3 (out): at PushController.sendToAdapter (/parse-server-gcm/node_modules/parse-server/lib/Controllers/PushController.js:171:27) index-3 (out): at /parse-server-gcm/node_modules/parse-server/lib/Controllers/PushController.js:128:23 index-3 (out): at run (/parse-server-gcm/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22) index-3 (out): at /parse-server-gcm/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28 index-3 (out): at flush (/parse-server-gcm/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9) index-3 (out): at _combinedTickCallback (internal/process/next_tick.js:67:7) index-3 (out): at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Server specifications:

Any help about this issue ?

Thanks,

iForests commented 8 years ago

Same here. Failed to send push notification to 406K users.

I'm using parse-server-push-adapter 1.0.4, and crashed on GCM.js:49:42 which is:

// Make a new array
devices = new (Function.prototype.bind.apply(Array, [null].concat(_toConsumableArray(devices))))();
flovilmart commented 8 years ago

PR are welcome, but attempting to send large number of pushes on a single parse-server will most likely fail.

Just so you realize, even if sending a push would only take 1ms, sending 400k would take about 6 minutes, saturating your instance and blocking anything else from happening.

iForests commented 8 years ago

Do you have any suggestion for sending a lot of push notifications based on parse-server's architecture? Thanks.

flovilmart commented 8 years ago

That's quite tricky, and falls into the bucket of high scalability of systems. For now I suggest you don't rely on Parse-server for large volume push delivery

jeacott1 commented 7 years ago

this is actually a simple fix. the main issue was too much magic causing the device array to be converted to function args ref #49

you'll need this fix too if you don't want your server locking up post push though: https://github.com/ParsePlatform/parse-server/pull/3264

still zero resilience/reliability though. should be pushed to a persistent queue/kafka/etc, and pulled from same to provide some.

the other potential issue with the existing code is the recursive nature of the split/1000 which will also fail at some point.