muraliwebworld / push-notification-plugin-for-wordpress-websites

Push Notification WordPress plugin in php, javascript using Firebase httpv1 for websites, Android/IOS mobile apps with PWA progressive web app
https://wordpress.org/plugins/push-notification-for-post-and-buddypress/
GNU General Public License v3.0
13 stars 1 forks source link

HOW DO I STOP CRAZY PLUGIN FROM SENDING 1 notification a billion times? #16

Open cvrle77 opened 1 month ago

cvrle77 commented 1 month ago

It is sending one notification for the past 30 minutes, I've received it on all devices 500 times.I cannot stop it, I've tried server reboot.

OMG WHAT IS GOING ON???? image

image

cvrle77 commented 1 month ago

I've barely managed to stop it from sending by rebooting server, and now it started sending different notification that I've not even scheduled or sent through post. Maybe I've sent it a week ago, but I can't tell, because there's no list of previously sent notifications, and I can't see processes and terminate them...

image

cvrle77 commented 1 month ago

And again

image

I took down your plugin, and won't be using it until you address this issue. This is a SERIOUS bug, probably the worst you can imagine for this type of app.

muraliwebworld commented 1 month ago

More than 200 active users using this plugin no one reported this problem even i tested all scheduled options, i am not sure what kind of configuration, it might be due to firebase configuration if you use same configuration in more than one site then you will get more than one same notification, for every site firebase project configuration and firebase project should be different. Without understanding firebase configuration and firebase knowledge it is difficult for me to explain, please read firebase documentation for httpv1 version configuration as well as for legacy configuration. It is most likely you used same configuration project id for more than one site whether it is test or live configuration should be different. Plugin will work based on action scheduler and there is no use in blaming me for this, please read firebase documentation, without understanding firebase knowledge, it is difficult for me to explain everything about firebase to you. This plugin is designed based on Firebase not by my own push notification

muraliwebworld commented 1 month ago

One of user is able to process push notification with more than 90000 customers and did not faced these kind of duplication notifications, https://wordpress.org/support/topic/the-last-update-1-85-skyrocketed-the-number-of-mysql-queries/#post-17694706

muraliwebworld commented 1 month ago

I think before some weeks, you asked for help on this site https://brzikolaci.com/ and test version of this site created and then now you push notifications are showing some other site name, i think you are using same project credentials for various sites and enabled scheduled, due to which firebase got confused because firebase tokens for your various websites are stored in same firebase project id ...it is mis configuration of firebase credentials across different website that is why i am telling to understand about Firebase push notification there is no need to blame me or this plugin. It is working on WordPress scheduler it will not repeat once it is cancelled but firebase tokens created for your various sites are under your single firebase project id that is the problem if you use httpv1 version then it is based on group notification it will assume all firebase tokens from your various sites are same and it will send it to particular project groups which are subscribed by your various sites which are using same credentials.

muraliwebworld commented 1 month ago

I have attached screenshots i used same credentials for my 3 different sites, I got same notification sent from one site in other sites also. Firebase is designed like that to store common token after subscription from every site and if you use same credentials across different sites then you will get same notification for different sites because your firebase token is stored in firebase server (not in wordpress) under same firebase project id and firebase assumes token was created from single app/single site due to this if you use same credentials across different sites then you will get same notification based on tokens created. So create different projects for every site and mobile apps for particular site should within corresponding project id created for site which mobile app webview created. For desktop sites, it is must to create different project ids. Following screen shot i got same notification across 3 different my test sites because i used same credentials across different sites but firebase tokens are stored in firebase server under same project id. Since you used same tokens and triggered notifcation from one of your test site or earlier site then that notification will be sent to all sites which are using same credentials. I have also tested scheduler both one time notifcation, i have attached screenshot it did not repeat for me once it is cancelled as shown below in action scheduler tab or in push settings schedule radio button turned off. If you repeatedly save the post again and again it will send notifcation while saving the post if you do not want to send the switch off checkmark in push notification in meta fields of post, it will not send notification when you saved the post. In below screenshot, I scheduled post every 300 seconds notification, Screenshot 2024-05-31 at 10 22 50 PM

Once it is schedule, you can check in action scheduler tab, it will show scheduling details Screenshot 2024-05-31 at 10 22 42 PM

After 300 seconds i got notification, since i used same credentials across 3 different sites, i got same notification from my 3 different test sites, Screenshot 2024-05-31 at 10 28 53 PM

You can also cancel the schedule directly in action scheduler tab(below screenshot) or in push settings tab (screenshot after below screenshot) Screenshot 2024-05-31 at 10 29 14 PM

Once it is cancelled there will no more schedule of notification in wordpress schedule, it will not send Screenshot 2024-05-31 at 10 29 25 PM

No more pending scheduled tasks here below screenshots Screenshot 2024-05-31 at 10 29 34 PM

Once it is cancelled there will no more schedule of notification in wordpress schedule, in action scheduler tab Screenshot 2024-05-31 at 10 29 34 PM

cvrle77 commented 1 month ago

I will try to provide as much data as possible.

This is my main website, I've not used credentials for Firebase of this website, on any other test project or website - EVER, not once. I do not play with my main website in any way.

I've used my second website for testing purposes. Yes, I have used same credentials on my small website, and on my localhost. This is how I learned that using same credentials on two websites will send two notifications. So I've replaced Firebase credentials for testing purposes, and I wrote about that, that I can't get Firebase server key from Firebase, and that there is no use because it is legacy. You replied that I could type anything in that field, and it worked. I've only used that testing environment on myself, with multiple devices and multiple browsers on each. This is how I've learned that I will send double notification if I use same credentials on multiple websites.

There's no misconfiguration, at least not on any basic level that I understand. I've made firebase project, and copied firebase details the way you described in your video instructions. I have never used THOSE credentials on something else, never swapped, changed, or copied those details on any other project, testing ground, website. I have checked them after reading, and they are typed only in one, main, website. Nowhere else.

Yes, I have two different websites - one main, large, and second one is way smaller.

They are separate firebase projects, and they have separate credentials. Localhost testing ground - copy of my smaller website - also have separate credentials from the two websites, and on test website, only I am a subscriber on multiple devices. image

This is not duplicate notification. That would imply only two notifications are sent.

It is one notification firing rapidly and indefinitely, like this process is multiplying itself, or like I am pushing Update button 100s of times. Notification is being received on my device, one after another 60-70 times, in just a few seconds, on just ONE device and one browser, and I have multiple subscriptions - PC and phone, three browsers on PC, two on phone. They all go crazy.

So even if it were double credentials used on two websites, I would get two notifications. This '60-70' is just last notification I've shown here, before I've rebooted my VPS, which was opened in another tab waiting for me. And even after reboot, it was firing again, sending some 30-40 notifications, and then it stopped. I did not see any process in action scheduler, that I could turn off or cancel.

This is not it, and I have no clue what it is, because there is no Notification jobs tab, where I can see process of notification being sent. I can't cancel, I can't retry, I don't have any control over the process, and I have no insights, when I send notification just by updating or publishing the post.

Here's the weird thing - my second - smaller website works as expected. It is set up exactly like the other site, I went through every single option 10 times. It doesn't do what larger website does. I've used smaller website for testing, and then copied settings that work the way I need it, onto a larger website. But this bombardment of notifications happens for some reason.

I've cleared Redis cache, I've cleared NGINX cache before sending notification for the second time, and it made no difference.

I didn't sent these notifications using scheduler. I've sent them as post update, checked the metabox, and that's it. When I send a notification like that, it is not showing in Push notifications list tab.

Also, If I send notification using Perfecty, there's no duplicates, just normal notification being sent once. Before you ask, I have tried with both Perfecty turned on and turned off, while I sent notification using PNFPB. No difference.

I have no idea, not a tiniest bit of what can cause this.

And last thing I have to say - I've only sent first and last notification. However, one notification from those three in the image was not even sent by me, by any means, not with scheduler, not with post update, not with duplicate credentials. I have no idea how that even happened, and it happened 55 minutes after the first notification was being sent, as you can see by the time or notification being received.

I don't use BuddyPress, PWA, Mobile app part, I don't use scheduler (yet) or One Time push, only simple notification on post publish or update. And to collect token from Perfecty users. Nothing else.

Maybe we could get in touch with some instant messengers? Viber, WhatsApp? my email is cvrle77 at gmail.com, not writing it properly on purpose.

muraliwebworld commented 1 month ago

Scheduling for post is done by plugin by cancelling previous schedule and it will schedule new one. It is only one piece of code there is no other place it is scheduled for post/custom post types. I recommend to do settings from scratch when you do it for a website and avoid copying database records containing settings from one site to another site.

Push notifications list tab is only for one time push notification not for post/custom/buddypress notifications. If you send one time push notifications (under one time push tab), it will be listed there and it can also be resend... For other notifications that feature is not available because some users are sending more notifications using post/buddypress then db will be overloaded if we are storing all notifcations which are sent for post/buddypress(as you know social media buddypress is like chat we cannot store all notifications)...may be i will add this in future by adding a new option to opt user for store post/buddypress notifications. At present push notification list tab is only for one time push notifications. You can also send one time push notification with link to post, custom text, image (like for promo or promo banners) and it will be listed in push notification list.

I recommend to do settings from scratch when you do it for a website and avoid copying database records containing settings from one site to another site. Since firebase tokens are generated automatically when it is subscribed no need to copy tokens if we copy tokens then it will create duplicate because token generation will vary for every website. my email id is murali@indiacitys.com , i will be available on Monday afterwards, once you send me email i will try to look into your request on monday or afterwards and i will inform you whatsapp number.

i request do not copy settings or tokens from one site to another because firebase tokens are stored in both in wordpress database as well as in firebase server and using these tokens notifications are sent by Firebase not by this plugin, this plugin calls firebase api to send notifications. So if firebase tokens are generated in one site and if that token is copied to another site along with settings then it will regenerate token again ....so for the new site/when you move to another site , it is better to do settings from scratch as tokens are automatically generated when user is already subscribed. I have also subscribed to https://brzikolaci.com/ before 2 weeks itself and i got notification today as show below from your site,i will be available on Monday afterwards, once you send me email i will try to look into your request on monday or afterwards and i will inform you whatsapp number. Screenshot 2024-06-01 at 2 50 23 PM

cvrle77 commented 1 month ago

I had the same idea, to create new Firebase project from scratch and redo everything. I've done this several hours ago, because there's least amount of users on my website at that time, so I can live test the setup. It seems everything is normal now, I've subscribed with 3 browsers, and one on my phone, I've sent few notifications and received everything as it should be.. Yes, I removed the plugin, and all tokens and everything gets removed from database (except customized text, it stays in DB table even if plugin is removed)

I have to notice that I did exactly the same thing like I did the first time.

I've experimented with brzikolaci.com and set up everything properly, and you can see for yourself that it is sending only one notification as it should. That means setup is correct. It never behaved like this. I've used that knowledge and created another Firebase project, and setup my second website. When I tested on myself, everything was ok, and I moved on. All my questions here were regarding brzikolaci.com and localhost copy of that site.

It is working even though I cannot properly define 'it works' and 'it doesn't work' because I don't know what is the problem and when it will pop up again. It's like queue got stuck in a loop every time I would send notification, and the only way to get out properly is to uninstall plugin, and redo installation all over again with different credentials. It could be some edge case, but you should think of how you can prevent it.

cvrle77 commented 1 month ago

No luck. Happening again.

It was working ok with 1000 subscribers. Didn't use it for two days. Now it is sending hundreds of notifications over and over. I've collected around 2500 subscribers.

No idea what is going on. I've updated the post so it can send notifications, it was working and working for like 5 minutes, and then I got internal server error, and then notifications started blasting. I had to reboot my server and deactivate plugin. So, we just established as a fact that it's not Firebase data.

And for the record, brzikolaci.com is sending notifications normally so far, 1200 subscribers.

Is there any PHP requirements/recommendations?

image