-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Some Push Notifications stuck in SENDING state #3562
Comments
@flovilmart It's the same problem that I raised in #3080 |
@adirgan Yes, it seems to be the same issue. My Parse Dashboard push page is very similar: the push status is changed correctly to SENT only if all the _Installation objects targeted by the push have a deviceToken. No matter if it's sent to a channel or specific recipients. From what I've read, is it safe to assume that all the push notifications that have an audience (with valid deviceToken) are actually sent anyway and that it is just an issue with Parse Server not updating _PushStatus correctly because of the faulty _Installation objects? I'm worried that this SENDING state means some performance issue or something bad with the server. If it is just a state update issue, I can live with that for now. |
@iOSassou Do not worry that the push messages arrive without problem and does not affect the performance at all, it is only an error to update the status. |
@adirgan Thank you |
@adirgan sorry, I believe the ball was dropped on my side on that... 🙇 I need to investigate further. But the state reporting has proven to be quite unreliable in general :/ |
@flovilmart Do not worry, while the problem is only visual and not performance is fine. |
@flovilmart @adirgan Yes. As long as it is not really affecting the app, I think it's fine (maybe just a bit confusing). |
Yeah that should be fixed however :/ that's clearly a regression |
@flovilmart Have found the same issue here after upgrading to the latest version. |
Need to add a small check to exclude installations without deviceToken from the query |
upgrade to apn 2.x is really the only solution for proper tracking. |
Also there is a bug that I uncovered that improperly forwards the deviceType on successful pushes. |
@flovilmart All iOS pushes are not being send, need to downgrade to Parse-Server 2.3.1 to get it working properly. |
@felipemobile are they not sent or just marked 'sending'? |
Not sent @flovilmart |
Uhm, not sent is more problematic than just not marked as Sent, can you provide more details, logs etc... to debug that issue? There was an underlying bug in the push adapter that prevented the push status to be properly reported. |
Sending a single push don't seem to cause the issue |
@flovilmart do you need any special type of log to debug that issue? |
Setting VERBOSE=1 should log all see https://github.com/parse-server-modules/parse-server-push-adapter/blob/master/src/index.js |
@flovilmart I've confirmed! This bug was introduced in the parse-server 2.3.3, maybe it's related to #3264 improvement. |
@felipemobile I know the bug is here, however I'm not sure the push are not delivered |
I've done a very simple and basic test: Works (Push sent 1)
Not working (Push sent 0)
|
yeah but are they delivered on the device? that doesn't really help here. |
Yeap, they are delivered only when using parse-server 2.3.2 or lower. |
Please, check this log:
|
So it reaches correctly the adapter but the connection is not found, and he status is not reported as failed. Can you check with a valid connection? |
@flovilmart This is a valid connection, changing to parse-server 2.3.2 works perfectly.
|
The adapter says the opposite, which is odd. |
In some way it's not clustering the devices per connections parse-server-push-adapter/APNS.js
Maybe a issue in the adapter? src/Adapters/Push/PushAdapter.js
|
I plan to change he way the state is changed from sending to sent in the next release. Perhaps aggressively right after all batches are scheduled. Then, you can check number sent that should properly reflect the counts. |
@bjorno You can downgrade your Parse-server to version 2.3.1 and it will work except for a high volume of push messages (80k installations seems to work fine). Please, check the change log for more info. You can downgrade your Parse-server by running the code: @flovilmart I'm running my own version of the parse-server-example. To give you an example of what I've done you can check the forked version where I've updated the parse-server-example to include a config file in json format and a way to run multiple instances of Parse-Server on different ports. Regarding the push issue, I think the setup function is not being called on the adapter. |
I really discourage running multiple parse-server on different ports unless you start multiple node process. the Parse SDK will only be initialized with the last provided AppId. |
@flovilmart It's running really fine for more than 20 apps! ;-) In the parse-server-push-adapter@1.1.0 you were handling all connection callbacks in the APNS.js but in the newest version I can see a huge difference. I will take some time this weekend to check line by line. Unfortunately I did not get a way to debug it yet.
|
As long as you don't use cloud code......... we know it can somehow look like it work, but it's really dangerous, you may end up saving data in the wrong app, and that I know it for a fact, as a large rejected PR shows |
@felipemobile That command does not seem to work, maybe because I installed the parse-server by downloading the entire parse-server-example zip file, and then pushed the entire thing to heroku. On my dashboard it just says server version 2.3.7. |
@bjorno Maybe you should install by using -g flag, so it will install the package into the global node_modules folder.
You can try to clear the cache or remove the folder (rm -rf node_modules):
|
@felipemobile Thanks for the suggestions! I managed to fix the problem when I realised that the real issue was that my .p12 cert had expired, and I never uploaded the renewed one. I appreciate you taking the time to help me though! |
@flovilmart running one instance of Parse-server in a single node process seems to solve the push issue however it has a downside when running multiple node process (20x) in a single amazon EC2 t2.micro instance. Can you give me an advice? Have you ever implemented a similar architecture? |
You should probably scale up this instance, 20 process would require about 4Gb of RAM+. We're running on kubernetes on multiple clusters and AZ's so we have quite a different setup, with different costs too |
@flovilmart I scale up to a t2.medium instance and it works however I've found something weird - Pushes are sent to all installations even when I define an audience. I've created a shell script that reads the config file and run 'forever' for each instance then I will be able to start or stop each app individually. |
@flovilmart Android messages are not counting towards the total so the status is stuck in SENDING state. |
uhh that's odd, need to check on the adapter why it doesn't count. |
@flovilmart Push Notifications stuck in SENDING state when an installation's deviceToken is set to null. I'm not sure if all push messages after this row are sent or if this bug is happening due to an unhandled exception: Line 649 in 2533a8c
I've found some old installations in my _Installation collection without deviceToken and pushType values (March/2015) for both Android and iOS devices. PS 1: the STATUS changes to SENT when I delete these buggy rows. |
We can force exclusion in the initial query so we don't count them nor fail |
Nice! I've confirmed that all other push messages are sent and status changes to SENT after deleting all rows with null value set on deviceToken column. @flovilmart What do you think if we force the exclusion here? |
Something like this: |
That would be on the where directly, if not set :) updateWhere is only used for the badge updates. |
Right, I need a little sleep. Maybe this code below should help here. If you agree I can try to write the according tests.
|
Yep, that should do, only if the property is not set :) |
@flovilmart the push stuck in sending state only if the property is not set :) |
Yep! |
I hope the problem will be solved with this pull request :) |
is this fixed? i just have same issue, trying sending ios and android push notifications, not sendind to anyone 😢 |
@cinder92 did you check your configuration? can you provide logs? This issue, involving _PushStatus stuck in sending state would actually get stuck AFTER sending and delivering the pushes. |
@flovilmart I am in the state as @cinder92 I recently added android and the issue of thing being stuck in send state for several users. It was working fine for a couple of days then broke for a certain chunk of users, possibly users who also use android as well. Ideas on what the issue is? my configuration was working now it just seems to have stopped. |
I can confirm that pushes stuck at the sending state never reach the device. |
Issue Description
I've recently moved my Parse Server instance to Heroku. I've put my push logic in Cloud Code instead of using client push and I can send and receive push notifications.
My issue is that the status of the push object is stuck at SENDING in Parse Dashboard ("status": "running" on the mongo object) when one of the pushes can't be delivered to an installation.
Example: I send a push to a list of users, but some of them have an installation with no deviceToken configured. Those with a deviceToken receive the push, but the others don't.
That's an expected result, but the push status will stay forever in the SENDING state and I'm not sure if I should worry about it or not.
Note: The push status is changed correctly to SENT if all the Installations have a deviceToken and the number of push sent matches the number of push delivered. Also this behaviour did not occurred when I was using client push.
Steps to reproduce
Send a push to one or more installations with some correctly configured and some with no deviceToken.
Expected Results
Those with a deviceToken receive the push, but the others don't.
The push status change to something other than "running" even if some failed.
Actual Outcome
The push object is stuck forever at SENDING in Parse Dashboard ("status": "running" on the mongo object) even is some notifications were delivered.
I'm not sure if this is a big issue and if I should worry about the server trying to send pushes indefinitely.
Environment Setup
Server
Database
Logs/Trace
Example: 3 pushes sent, 1 device received it, 2 failed because of missing deviceToken. Push object now in sending state forever.
_PushStatus object
Cloud Code
The text was updated successfully, but these errors were encountered: