Comments (11)
This should fix the issue. I'm not quite ready to do another release as there are some other changes in master I'd like to test some before I do. If you are able to run rapns from master a try that'd be great.
from rapns.
Thank you for the fast response.
I ran rapns from master and, unfortunately, the problem persists. I notice that there is another "stop" situation that could be causing the error.
On deliver_handler_pool.rb
def object_removed_from_pool(object)
object.stop
end
Could it be causing the error?
from rapns.
I don't believe so. That stop call is on an instance of DeliveryHandler, which simply sets an instance variable. How did you use rapns from master? I was almost certain that commit would have fixed it.
from rapns.
I put
gem 'rapns', :git => 'https://github.com/ileitch/rapns.git', :branch => 'master'
on my Gemfile. Isn't that correct?
from rapns.
I tested a little further.
After I restarted, the [ERROR] did stop appearing. Unfortunately, the duplicate error still happens.
Here's the log
[2011-11-28 18:17:51] [Connection 0] Connected to gateway.sandbox.push.apple.com:2195
[2011-11-28 18:17:51] [Connection 1] Connected to gateway.sandbox.push.apple.com:2195
[2011-11-28 18:17:51] [Connection 2] Connected to gateway.sandbox.push.apple.com:2195
[2011-11-28 18:17:51] Ready
[2011-11-28 18:18:15] Notification 129 delivered to d46...
[2011-11-28 18:18:16] Notification 131 delivered to c40...
[2011-11-28 18:18:16] Notification 130 delivered to 1a7...
[2011-11-28 18:18:17] Notification 132 delivered to 30a...
[2011-11-28 18:18:17] Notification 133 delivered to 732...
[2011-11-28 18:18:17] Notification 134 delivered to a4a...
[2011-11-28 18:18:17] Notification 133 delivered to 732...
[2011-11-28 18:18:17] Notification 134 delivered to a4a...
Notice that notifications 133 and 134 were sent twice. I thought is had something to do with the 'stop' error but it seems to be something different. Should I open another issue?
from rapns.
Ah, I see the what the cause of the duplicates is. I'll try get to it in the next few days.
from rapns.
Great! I'll keep the master branch. Let me know when you fix the issue so I can test it for you.
from rapns.
Bump on this -- what's the source of the duplicates and how concerned should I be? I have rapns in production and duplicated push notifications are a large concern for me.
from rapns.
The problem is a race condition. In a nutshell, rapns container a Feeder thread and multiple Delivery threads, they communicate using a thread-safe queue.
The Feeder waits until a Delivery thread is idle and then loads more notifications into the queue. If the Feeder pushes more notifications into the Queue than there are Delivery threads (3 by default), then it is possible for a Delivery thread to become idle and the Feeder load more notifications. The problem is that the Queue may still contain notifications from the previous load, and a notification may enter the queue twice.
The simple fix is to just wait until the Queue is empty before loading more notifications, This is in fact how rapns used to work, but I changed it some while ago to improve throughput.
So the chances of this is somewhat low, but none the less I will look at this later today and see if I can come up with a solution that doesn't hurt throughput.
from rapns.
ileitch, now that you explained, everything makes sense.
When I send 1~3 notifications, no problem, but when I send more, the 4th and following notifications are sent twice.
In my case, is very common to send multiple notifications at a time because it is an alert I send to multiple users. It'd be very nice if you find a solution - or at least suggest some workaround I could use until then.
from rapns.
This issue should be closed, I've opened a new duplicate message specific Issue #20
from rapns.
Related Issues (20)
- Update at the end HOT 2
- Rapns Worker stalls and not setting notifications as delivered HOT 8
- Multiple databases support HOT 2
- Trying Rapns with Safari Push HOT 10
- NoMethodError raised when GCM post responds with 500
- add notification table HOT 4
- Rapns daemon process get killed HOT 4
- [ERROR] NoMethodError, undefined method `to_binary' for Rapns::Notification HOT 4
- GCM returns an error for messages with Spanish characters
- new release? HOT 5
- fatal: deadlock detected HOT 1
- fatal: deadlock detected
- ActiveRecord::ConnectionTimeoutError HOT 3
- NameError, uninitialized constant Rapns::Daemon::Apn HOT 3
- Notification received on the phone but the rapns_notifications database still list the notification as not delivered
- apns slow HOT 2
- Testing github-issues-import.
- Best practise for maintaining rapns_notifications table.
- Certificate has been revoked (Rails Console & Controller both) HOT 1
- @app should be @app.name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapns.