Giter VIP home page Giter VIP logo

rapns's Introduction

rapns's People

Contributors

alexperto avatar blakewatters avatar bongole avatar darrylyip avatar dianthudia avatar emeitch avatar exviva avatar forresty avatar ileitch avatar jcoleman avatar marcrohloff avatar mattconnolly avatar maxsz avatar perezda avatar seigur avatar shaokun avatar sjmadsen avatar taybenlor avatar tompesman avatar travisvalentine avatar wilg avatar yoppi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rapns's Issues

Message send always gets error code 8 (Invalid Token)

hi There,
I have rapns running and it seems to work intermittently. I've noticed that the error_code is nearly always set to 8, even though the message is delivered. (the delivered_at and failed_at are the same time). furthermore, i can't locate the method that is writing the error to the database. all debugging i have shows that the Notification Object is being saved in a "successful" state in the deliver method of the DeliveryHandler class.

any hints on how to get around this?

thanks,

adam.

Support mixed-mode environments per app

With the multi-app solution, I'd like to run some of the apps in production environment, and some in development. Is this possible today? I tried setting the environment name on each Rapns::App and having the different sandbox and production server info in the rapns.yml.

Exception due to db connection problem

Hello,
in rapns.log I'm having errors like: "[ERROR] ActiveRecord::ConnectionTimeoutError, could not obtain a database connection within 5 seconds (waited 5.000155766 seconds). The max pool size is currently 5; consider increasing it."

It looks that the problem is in /rapns/daemon/delivery_handler.rb:54 where there is a "save!"

Probably the solution would be to check if db connection is still present before calling "save!"

This problem is related with #69 (so all considerations about database pool still remains), the main problem is that we can't continue to slowly send notifications due this exception.
If "db connection loose" would be handled probably we could continue to (slowly) send notifications (while we find another way to solve the problem better)

Actually I'm not sure of my last phrase, I'm just guessing

Notifications not delivered

Hello,
I'm using rapns on my app, but sometimes it stops to deliver notifications. Notifications in db are simply "delivered: false" without errors and without feedbacks. After restarting rapns daemon it delivers everything immediately. After restarting daemon it works for some time (various, I couldn't find an exact timing) and then the problem re-happens.

I would like what it can be in your opinion to make this behaviour, I tryed to google for it but I had no luck

Thank you very much
Simone

Possible MDM issue.

Reported by @zmajstor

$ bundle exec rapns production -f
[2012-07-24 23:32:31] [DeliveryHandler:my_app2] Connected to gateway.push.apple.com:2195
[2012-07-24 23:32:31] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-24 23:33:32] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-24 23:33:46] [DeliveryHandler:my_app2] 3 sent to 92e5bf612965f22a72a5b17b9516fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-24 23:34:33] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-24 23:34:33] [FeedbackReceiver:my_app2] Delivery failed at 2012-07-24 21:33:46 UTC for 92e5bf612965f22a72a5b17b9516fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-24 23:34:33] [ERROR] ActiveRecord::RecordInvalid, Validation failed: Device token can't be blank, Device token is invalid, Failed at can't be blank

Notifications Delivered Multiple Times

Moving this from #18 as a standalone issue. We are seeing duplicated delivery of notifications due to a race with the Feeder.

Note that this is happening pretty regularly for me on GateGuru.

App#environment validation is too strict

Rapns makes the assumption that the only environments possible in Rails are development and production. Most of the projects I work on currently have staging environments as separate from production.

I see two possible solutions: find a way to interrogate Rails to find all possible environments or just remove the validation as the worst case scenario with a typo'd environment is that the notifications aren't sent. I haven't found any way yet to determine the possible environments in a Rails app, so I think think it makes sense to just remove the validation.

Thoughts?

Edit: I see now why that's important; Rapns needs to know how to map the environment to the correct Apple gateway. Perhaps it could default everything except production to the sandbox and accept configuration for anything else?

Major Performance Problem with ready_for_delivery Scope

We just ran into a nasty issue on production with rapns. The way that the ready_for_delivery scope is written on Rapns::Notification using Arel finders being merged together results in several database queries being issued. Observe:

Running console attached to terminal... up, run.1
Loading production environment (Rails 3.1.3)
irb(main):001:0> Rapns::Notification.ready_for_delivery.count
Rapns::Notification Load (22.2ms)  SELECT "rapns_notifications".* FROM "rapns_notifications" WHERE (deliver_after IS NULL)
 Rapns::Notification Load (1.1ms)  SELECT "rapns_notifications".* FROM "rapns_notifications" WHERE (deliver_after < '2012-01-12 18:30:53.706636')
 Rapns::Notification Load (0.2ms)  SELECT "rapns_notifications".* FROM "rapns_notifications" WHERE "rapns_notifications"."delivered" = 'f' AND "rapns_notifications"."failed" = 'f'

The issue is that the first query (deliver_after IS NULL) returns a giant result set. On our production installation, this can retrieve over 100k rows before the secondary notifications cull the result set that is ultimately returned.

Pull request forthcoming.

Improve Heroku experience

rapns needs to run seamlessly on Heroku. Where that's not possible; we need clear and simple instructions.

Race condition between Feeder and DeliveryHandlers

If a delivery takes longer than the poll frequency, the Feeder may push the notification into the queue again before the delivery handler is able to mark the notification as delivered. This can result in the notification being sent multiple times.

How to keep rapns daemon working on heroku?

I used this gem - thank you for the nice work! -, and deployed an app to heroku .
My environnement: Rails 3.1.3 - heroku cedar stack.

On my machine, after having launched the daemon with bundle exec rapns development, everything works fine, and I receive the push notifications.

Trying to deploy it on heroku:
When I launch the daemon with the option --foreground, everything works fine, and I receive the push notification.
When I let the process fork into a daemon, it only lives for a few seconds.

Command used on heroku:

Works (but gets killed if I close my terminal window)

heroku run bundle exec rapns production --foreground

Without the --foreground: Process doesn't live:

heroku run bundle exec rapns production

For example:
$ heroku run bundle exec rapns production

Running bundle exec rapns production attached to terminal... up, run.24

$ heroku ps

Process       State               Command
------------  ------------------  ------------------------------
run.24        complete for 6s     bundle exec rapns production
web.1         up for 49m          bundle exec rails server -p $PORT

Output of the logs at the same time:

2012-01-01T23:00:57+00:00 app[run.24]: Starting process with command `bundle exec rapns production`
2012-01-01T23:01:04+00:00 heroku[run.24]: State changed from up to complete
2012-01-01T23:01:05+00:00 heroku[run.24]: Process exited

I'm not sure where the issue is.
Do I need to scale my heroku config (tried to up the workers), or is there a bug with rapns when forking into a daemon?

Daemon start breaks when an app produces SSL error

When I start the rapns daemon with bundle exec rapns development -f it will be stopped when an application produces an ssl error during certificate and key load:

[2012-08-12 17:37:07] [Sync] Loading app: das
[2012-08-12 17:37:07] [ERROR] OpenSSL::SSL::SSLError, SSL_CTX_use_PrivateKey:: key values mismatch
/Users/dei79/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rapns-b3797edc5c27/lib/rapns/daemon/connection.rb:103:in initialize' /Users/dei79/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rapns-b3797edc5c27/lib/rapns/daemon/connection.rb:103:innew'
/Users/dei79/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rapns-b3797edc5c27/lib/rapns/daemon/connection.rb:103:in `connect_socket'

Would be better to ignore this app and add somewhere an error information

Rapns won't write to log file in production

Hi,

I notice that rapns, in production environment (Ubuntu), is creating the log file when I start the service but isn't writing to it.

I checked the file permissions and everything seem to be fine.

In development environment (Mac OS), the log file is ok.

Here is my log directory in production

drwxrwxr-x 2 mob mob    4096 2011-12-16 16:04 ./
drwxrwxr-x 6 mob mob    4096 2011-08-11 23:13 ../
-rw-r--r-- 1 mob mob     621 2011-11-25 21:22 development.log
-rw-r--r-- 1 mob mob 3923116 2011-12-16 16:07 production.log
-rw-r--r-- 1 mob mob       0 2011-12-16 16:04 rapns.log

Any ideas?

ActiveRecord::ConnectionNotEstablished when installing rapns

when adding the rapns gem in gemfile, execute bundle install and trying to rails g rapns, i get the following error:

/Users/foo/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)

using rails 3.2.6 and ruby 1.9.3

when remove rapns from gemfile it works again. any advice?

Starting the rapns daemon when no app exists

I tried to start the rapns deaemon when no application exists. This breaks with the following error:

!!!! RAPNS NOT STARTED !!!!

You must create an Rapns::App.
See https://github.com/ileitch/rapns for instructions.

I plan to use the HUP hot update feature to notify rapns that a new application comes in. When I deploy my application to a new server and I bring all daemons app and running (based on god) naturally no application exists.

Any options?

UTF-8 symbols in alert

I am using utf-8 symbols in alert messages, but instead of

Аттикус Финч

I am receiving

\xD0\x90\xD1\x82\xD1\x82\xD0\xB8\xD0\xBA\xD1\x83\xD1\x81 \xD0\xA4\xD0\xB8\xD0\xBD\xD1\x87

I use ruby 1.8.7

How can I work-around it?

rails g rapns created multiple migrations with the same timestamp + migration duplications

Hi,

I just ran 'rails g rapns' and ended up with the following new files:

#   config/rapns/
#   db/migrate/20120214214103_create_rapns_feedback.rb
#   db/migrate/20120214214103_create_rapns_notifications.rb
#   db/migrate/20120214214104_add_alert_is_json_to_rapns_notifications.rb

However running rake db:migrate results in:

➜  git:(feature/rapns) ✗ rake db:migrate                                                                                      ruby-1.9.3-p0@wc-offers
rake aborted!
Multiple migrations have the version number 20120214214103

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I'm not sure if this is result of your generator or if my local Rails (3.2.1) freaked out.

Also, the last migration that was generated to 'add_alert_is_json_to_rapns_notifications' seems like it is simply adding a new column to the first migration table generated. Could this not be rolled into the migration that does 'create_table :rapns_notifications'?

Daemon Fails initialization on Heroku

While attempting to deploy rapns on Heroku, the daemon is failing to initialize due to the call to auto_flushing. Pull request with fix coming momentarily.

Multiple apps and database backed certificates

We need to be able to send notifications to third party apps.

We created an interface in which developers can upload a certificate for their app.

Basically we need to be able to provide a certificate when we create the notification.

Before I start hacking rapns I was wondering what you though.

How to do In-App HUP

In my app I want to add Rapns::App object to the database through an admin backend. Because of that I want to resync the app runner when the object was generated. What is the best way to do that? Is it an option to implement something in Rapns which store a resync flag in the database?

device_token validation fails?

i try to send a notification to "02b8ed402230776c6a26f1d189457b9f4c188d8a", but the validation is telling

Validation failed: Device token is invalid

what is rapns validating? type and length should be alright? is it a bug?

thanks!

High CPU load when running in staging environment

Hello,

I have 2 rapns processes running on the same server, one process runs in the production environment, the other one runs in the staging environment. In the production environment the CPU load is 4-5% and in the staging environment the load is around 25%. I suspect the logging of the SQL requests in the staging.log file increases the CPU load. Is this the expected behavior? Can I control the level of logging from the configuration file? If not, you can consider this issue a feature request.

Regards,

Tom

Heroku logging issues

Hello,
I'm running on Heroku in staging environment, I get this error on startup, preventing me from using rapns:

/app/vendor/bundle/ruby/1.9.1/gems/rapns-2.0.4/lib/rapns/daemon/logger.rb:6:in `initialize': No such file or directory - /app/log/rapns.log (Errno::ENOENT)

Procfile:

apn: bundle exec rapns $RACK_ENV -f -n

Am I the only one with this issue? Rails 3.2, Cedar stack.

Support for Splitting Pushes into Pieces

I have developed some custom support for taking a single large message and delivering it in multiple notifications. If there's interest, I'd be happy to extract it from GateGuru into an rapns API. I'm thinking something like:

Rapns::Notification.deliver_long_alert!(long_alert_text, :device_token => 'whatever'

Or whatever API makes the most sense

[ERROR] NoMethodError, undefined method `stop' for #<Thread:0x2b93fe06b360 run>

Daemon is logging this error:

[ERROR] NoMethodError, undefined method `stop' for #<Thread:0x2b93fe06b360 run>

when I submit several notifications at once.

Here's an example

[2011-11-25 20:26:28] [ERROR] NoMethodError, undefined method `stop' for #<Thread:0x2b93fe06b360 run>
[2011-11-25 20:26:29] Notification 63 delivered to c40...
[2011-11-25 20:26:29] Notification 61 delivered to d46...
[2011-11-25 20:26:29] Notification 62 delivered to 1a7...
[2011-11-25 20:26:29] [ERROR] NoMethodError, undefined method `stop' for #<Thread:0x2b93fe06b360 run>
[2011-11-25 20:26:29] Notification 65 delivered to 732...
[2011-11-25 20:26:29] Notification 64 delivered to 30a...
[2011-11-25 20:26:29] Notification 66 delivered to a4a...
[2011-11-25 20:26:30] Notification 64 delivered to 30a...
[2011-11-25 20:26:30] Notification 66 delivered to a4a...
[2011-11-25 20:26:30] Notification 65 delivered to 732...

Please, note that notifications 61, 62 and 63 are sent once, but 64, 65 and 66 are sent twice. The associated devices are receiving two notifications as well.

Pipe: Too many open files (err)

Getting error while running after about 5 minutes.
If I remove the @_sleep_check and IO.select lines in interuptiblesleep.rb the daemon keeps working but connects to the feedback service every second or so and uses a lot more resources of the machine its running on.

[2012-01-31 11:51:09] [DeliveryHandler 0] Connected to gateway.sandbox.push.apple.com:2195
[2012-01-31 11:51:10] [DeliveryHandler 1] Connected to gateway.sandbox.push.apple.com:2195
[2012-01-31 11:51:11] [DeliveryHandler 2] Connected to gateway.sandbox.push.apple.com:2195
[2012-01-31 11:51:11] Ready
[2012-01-31 11:51:13] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-31 11:52:14] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-31 11:53:14] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-31 11:54:16] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-31 11:55:18] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
/Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon/interruptible_sleep.rb:5:in `pipe': Too many open files (Errno::EMFILE)
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon/interruptible_sleep.rb:5:in `interruptible_sleep'
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon/feeder.rb:17:in `start'
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon/feeder.rb:14:in `loop'
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon/feeder.rb:14:in `start'
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/lib/rapns/daemon.rb:52:in `start'
    from /Library/Ruby/Gems/1.8/gems/rapns-1.0.3/bin/rapns:28
    from /Library/Ruby/Gems/1.8/bin/rapns:19:in `load'
    from /Library/Ruby/Gems/1.8/bin/rapns:19

Validate Notifications to not exceed allowable length for APS protocol

Add a validator to the Rapns::Notification model to prevent a payload of more than 256 bytes as per protocol:

https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9

When notifications are to be delivered later, the failure will not be known until a later time, which may be frustrating for the user sending the notification to not know if it will be sent or not. This failure condition can be prevented with a validator.

When notification save, got SQLException

[2012-01-24 22:50:06] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:51:07] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:52:09] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:53:11] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:54:12] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:55:13] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:56:15] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:57:17] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:58:18] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:59:20] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2012-01-24 22:59:25] [ERROR] SQLite3::SQLException, cannot start a transaction within a transaction
[2012-01-24 22:59:25] [ERROR] SQLite3::SQLException, cannot start a transaction within a transaction
[2012-01-24 22:59:27] [ERROR] SQLite3::SQLException, cannot start a transaction within a transaction

It seems this error makes multiple notifications.

Connects to the Feedback Service constantly

This is in RAPNS 1.0.2.

I know this is a recent addition, and perhaps I need to configure something differently, but this is what I'm seeing in my rapns logs:

[2012-01-13 13:22:34] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:23:34] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:24:34] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:25:34] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:26:35] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:27:35] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:28:35] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:29:35] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:30:36] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:31:36] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:32:36] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:33:37] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:34:37] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:35:37] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:36:37] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:37:38] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:38:38] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:39:39] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:40:39] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:41:39] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:42:39] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:43:39] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:44:40] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:45:40] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:46:40] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:47:40] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:48:41] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:49:41] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:50:41] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:51:41] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:52:42] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:53:42] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:54:42] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:55:42] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:56:43] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:57:43] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:58:43] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 13:59:44] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:00:44] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:01:44] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:02:44] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:03:45] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:04:45] [FeedbackReceiver] Connected to feedback.push.apple.com:2196
[2012-01-13 14:05:45] [FeedbackReceiver] Connected to feedback.push.apple.com:2196

It seems to be connecting to the feedback service several times a second.

god configuration

I played a bit with your sample god configuration. I also read that it's better to let god do the daemonizing. There are anything against the following change of the god configuration

God.watch do |w|
w.name = 'rapns'

w.start = "cd #{rails_root} && bundle exec rapns #{rails_env} -f"

w.uid = 'deploy'
w.gid = 'deploy'

w.keepalive
end

can't run this on Heroku

Hi there,

First thing first, I tested rapns on my local machine, all good. The things is I'm new to RoR (I'm an iOS dev) and I'm hosting the server-side code on Heroku.

Issue: I wanted to run following on Heroku
bundle exec rapns

I understand this step is to kick start a background daemon which check the database for new notification to deliver periodically. I used following command:
heroku run bundle exec rapns production --foreground

which gave me:
Running bundle exec rapns production --foreground attached to terminal... up, run.3
[WARNING] Detected Rails 3.1.1, patching PostgreSQLAdapter to fix reconnection bug: rails/rails#3160
/app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:in initialize': No such file or directory - /app/tmp/pids/rapns.pid (Errno::ENOENT) from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:inopen'
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:in write_pid_file' from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:43:instart'
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/bin/rapns:28:in <top (required)>' from /app/.bundle/gems/ruby/1.9.1/bin/rapns:19:inload'
from /app/.bundle/gems/ruby/1.9.1/bin/rapns:19:in `

'

So it's something about .pid file. I read the readme, it's set to blank in rapns.yml. I couldn't go further, please help me.

My email is [email protected]

Thank you very much!!!

rapns on Windows Server 2008 R2

Any idea how to start rapns deamon on Windows Server 2008 R2 with installed Ruby 1.9.3p0 and all needed Rails gems?
Here is error stack after command prompt command: bundle exec rapns production

c:/Ruby19/lib/ruby/gems/1.9.1/gems/rapns-2.0.4/lib/rapns/daemon.rb:72:in `trap': unsupported signal SIGHUP (ArgumentError)
      from c:/Ruby19/lib/ruby/gems/1.9.1/gems/rapns-2.0.4/lib/rapns/daemon.rb:72:in `setup_signal_hooks'
      from c:/Ruby19/lib/ruby/gems/1.9.1/gems/rapns-2.0.4/lib/rapns/daemon.rb:30:in `start'
      from c:/Ruby19/lib/ruby/gems/1.9.1/gems/rapns-2.0.4/bin/rapns:46:in `<top (required)>'
      from c:/Ruby19/bin/rapns:19:in `load'
      from c:/Ruby19/bin/rapns:19:in `<main>'

Having upgraded to 2.0.0, Rapns daemon seems not to work properly on production

I've been using this great gem for a while locally in development environment and everything worked well. After upgrading to 2.0.0, running it remotely on production environment does not work properly.

I successfully create new notification with :
n = Rapns::Notification.new
n.app = "testapp"
n.device_token = "HEX"
n.alert = "Test notification!!"
n.badge = 1
n.sound = "1.aiff"
n.expiry = 1.day.to_i
n.deliver_after = 1.hour.from_now
n.save!

However, running Rapns daemon in foreground mode gives no indication that anything had happend and the rapns.log file is empty.

Am I doing anything wrong or is there an issue with the new version ?

Thanks anyhow,
Hadar.

Looped notification delivery

Hello!

Thanks for simple to use gem. But i have such a problem:

When I create notification it start to deliver itstelf in loop. Typical loop in log is:

  SQL (0.1ms)  BEGIN
Mysql::Error: MySQL server has gone away: BEGIN
  Rapns::Notification Load (0.4ms)  SELECT `rapns_notifications`.* FROM `rapns_notifications` WHERE (deliver_after IS NULL)
  Rapns::Notification Load (0.4ms)  SELECT `rapns_notifications`.* FROM `rapns_notifications` WHERE (deliver_after < '2011-09-23 04:50:04')
  Rapns::Notification Load (0.3ms)  SELECT `rapns_notifications`.* FROM `rapns_notifications` WHERE `rapns_notifications`.`delivered` = 0 AND `rapns_notifications`.`failed` = 0
  Rapns::Notification Load (0.3ms)  SELECT `rapns_notifications`.* FROM `rapns_notifications` 

That is notification that was created (it not changes)

#<Rapns::Notification id: 6, badge: nil, device_token: "961acc448cf71ed21a6ca0d23835ed31e58a1428c2005d45ae7...", sound: "1.aiff", alert: "\xD0\x90\xD1\x82\xD1\x82\xD0\xB8\xD0\xBA\xD1\x83\xD1\x81 \xD0\xA4\xD0\xB8\xD0\xBD\xD1\x87 invited you to play Battles...", attributes_for_device: nil, expiry: 21600, delivered: false, delivered_at: nil, failed: false, failed_at: nil, error_code: nil, error_description: nil, deliver_after: nil, created_at: "2011-09-23 04:49:52", updated_at: "2011-09-23 04:49:52">

I am in development evnironment. What can be a problem?

Infinite notification loop

First of all, thanks for the rapns gem! I just experienced a strange behavior, after running flawlessly for over a week the following happend in the log. Initially it looks like the gem looses connection to the APN server and restores it successfully, but the connection is lost to the MYSQL server and not successfully restored. Therefore it fails to update the record to mark the notification it has been sent, but it somehow retreives the same record to be delivered, resulting in a notification sent every 2 seconds. :-)

[2011-12-20 15:53:58] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2011-12-20 15:54:59] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2011-12-20 15:56:00] [FeedbackReceiver] Connected to feedback.sandbox.push.apple.com:2196
[2011-12-20 15:56:04] [ERROR] [DeliveryHandler 1] Lost connection to gateway.sandbox.push.apple.com:2195 (Errno::EPIPE), reconnecting...
[2011-12-20 15:56:05] [DeliveryHandler 1] Connected to gateway.sandbox.push.apple.com:2195
[2011-12-20 15:56:06] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:06', `updated_at` = '2011-12-20 14:56:06', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:08] [ERROR] [DeliveryHandler 2] Lost connection to gateway.sandbox.push.apple.com:2195 (Errno::EPIPE), reconnecting...
[2011-12-20 15:56:09] [DeliveryHandler 2] Connected to gateway.sandbox.push.apple.com:2195
[2011-12-20 15:56:10] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:10', `updated_at` = '2011-12-20 14:56:10', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:12] [ERROR] [DeliveryHandler 0] Lost connection to gateway.sandbox.push.apple.com:2195 (Errno::EPIPE), reconnecting...
[2011-12-20 15:56:13] [DeliveryHandler 0] Connected to gateway.sandbox.push.apple.com:2195
[2011-12-20 15:56:14] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:14', `updated_at` = '2011-12-20 14:56:14', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:17] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:17', `updated_at` = '2011-12-20 14:56:17', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:19] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:19', `updated_at` = '2011-12-20 14:56:19', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:21] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:21', `updated_at` = '2011-12-20 14:56:21', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86
[2011-12-20 15:56:23] [ERROR] ActiveRecord::StatementInvalid, Mysql2::Error: MySQL server has gone away: UPDATE `rapns_notifications` SET `delivered_at` = '2011-12-20 14:56:23', `updated_at` = '2011-12-20 14:56:23', `delivered` = 1 WHERE `rapns_notifications`.`id` = 86

Is it possible to force a reconnect to the database?

Regards,

Tom

Eror when starting rapns daemon

I'm getting the following error when I run:

bundle exec rapns production

My current rails version is 3.2.1, ruby 1.9.3p0.

Am I missing something installing rapns?

/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.1/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb:68:in `register_javascript_expansion': undefined method`each' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.1/lib/action_view/railtie.rb:21:in `block (2 levels) in ' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in`instance_eval' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:26:in`on_load' from /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.1/lib/action_view/railtie.rb:20:in `block in ' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in`instance_exec' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in`block in run_initializers' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in`run_initializers' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in`method_missing' from /home/yiftee/yiftee/config/environment.rb:5:in `' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in`require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in`load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require' from /home/yiftee/yiftee/config/initializers/yiftee_config.rb:1:in`' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in`block in load' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in`load' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in ' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in`each' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in ' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in`instance_exec' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in`block in run_initializers' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in`run_initializers' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in`method_missing' from config/environment.rb:5:in `' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in`load' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `block in load' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in`load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load' from /home/yiftee/.bundler/ruby/1.9.1/rapns-c0aebe9f7f48/bin/rapns:24:in`' from /usr/local/lib/ruby/gems/1.9.1/bin/rapns:19:in `load' from /usr/local/lib/ruby/gems/1.9.1/bin/rapns:19:in`'

How to kill the Daemon

I have no idea how to kill the daemon on our staging sever which appears to be running multiple daemons aswell.

I cannot find the pid file anywhere nor can I see it using ps aux

Can somebody please let me know how to KILL it

Can't start rapns daemon

Getting this error when attempting to start rapns daemon. Already did generation and migration. Using ruby 1.8.7-p330 and rails 3.0.7. The app does not encounter this error when run with rails server, etc.

Not sure if this is a bug in rapns, but hoping someone might know the cause.

david@mac:~/Code/web/myapp$ bundle exec rapns -f
/Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/mysql-2.8.1/lib/mysql_api.bundle: Mysql is not a class (TypeError)
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/mysql-2.8.1/lib/mysql.rb:3
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
        from /Users/david/Code/web/myapp/config/application.rb:7
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
        from ./config/environment.rb:2
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/gems/rapns-1.0.4/bin/rapns:24
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/bin/rapns:19:in `load'
        from /Users/david/.rvm/gems/ruby-1.8.7-p330@ql_myapp/bin/rapns:19

environment.rb:

# Load the rails application
require File.expand_path('../application', __FILE__) # <---- line 2
require 'rest_client'

# ...

application.rb:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler) # <---- line 7

# ...

Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.7'

gem 'mysql'

gem 'json'

gem 'yaml_db'

gem 'engineyard'

gem 'authlogic'

gem 'paperclip'

gem 'mime-types', :require => 'mime/types'

gem 'aws-s3'

gem 'cancan'

gem 'composite_primary_keys', '=3.1.0'

gem 'nokogiri'

gem 'savon'

gem 'rapns'

Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    abstract (1.0.0)
    actionmailer (3.0.7)
      actionpack (= 3.0.7)
      mail (~> 2.2.15)
    actionpack (3.0.7)
      activemodel (= 3.0.7)
      activesupport (= 3.0.7)
      builder (~> 2.1.2)
      erubis (~> 2.6.6)
      i18n (~> 0.5.0)
      rack (~> 1.2.1)
      rack-mount (~> 0.6.14)
      rack-test (~> 0.5.7)
      tzinfo (~> 0.3.23)
    activemodel (3.0.7)
      activesupport (= 3.0.7)
      builder (~> 2.1.2)
      i18n (~> 0.5.0)
    activerecord (3.0.7)
      activemodel (= 3.0.7)
      activesupport (= 3.0.7)
      arel (~> 2.0.2)
      tzinfo (~> 0.3.23)
    activeresource (3.0.7)
      activemodel (= 3.0.7)
      activesupport (= 3.0.7)
    activesupport (3.0.7)
    addressable (2.2.6)
    arel (2.0.9)
    authlogic (3.0.2)
      activerecord (~> 3.0.7)
      activerecord (~> 3.0.7)
    aws-s3 (0.6.2)
      builder
      mime-types
      xml-simple
    builder (2.1.2)
    cancan (1.6.4)
    composite_primary_keys (3.1.0)
      activerecord (>= 3.0.3)
    engineyard (1.3.33)
      engineyard-serverside-adapter (= 1.4.16)
      escape (~> 0.0.4)
      highline (~> 1.6.1)
      json_pure
      launchy (= 2.0.5)
      net-ssh (~> 2.1.0)
      rest-client (~> 1.6.0)
      thor (~> 0.14.6)
    engineyard-serverside-adapter (1.4.16)
      escape (~> 0.0.4)
      json_pure
    erubis (2.6.6)
      abstract (>= 1.0.0)
    escape (0.0.4)
    gyoku (0.4.3)
      builder (>= 2.1.2)
    highline (1.6.2)
    httpi (0.9.3)
      ntlm-http (>= 0.1.1)
      rack
    i18n (0.5.0)
    json (1.5.1)
    json_pure (1.6.1)
    launchy (2.0.5)
      addressable (~> 2.2.6)
    mail (2.2.19)
      activesupport (>= 2.3.6)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.16)
    mysql (2.8.1)
    net-ssh (2.1.4)
    nokogiri (1.4.4)
    nori (0.2.0)
    ntlm-http (0.1.1)
    paperclip (2.3.11)
      activerecord (>= 2.3.0)
      activesupport (>= 2.3.2)
    polyglot (0.3.1)
    rack (1.2.2)
    rack-mount (0.6.14)
      rack (>= 1.0.0)
    rack-test (0.5.7)
      rack (>= 1.0)
    rails (3.0.7)
      actionmailer (= 3.0.7)
      actionpack (= 3.0.7)
      activerecord (= 3.0.7)
      activeresource (= 3.0.7)
      activesupport (= 3.0.7)
      bundler (~> 1.0)
      railties (= 3.0.7)
    railties (3.0.7)
      actionpack (= 3.0.7)
      activesupport (= 3.0.7)
      rake (>= 0.8.7)
      thor (~> 0.14.4)
    rake (0.8.7)
    rapns (1.0.4)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    savon (0.9.2)
      builder (>= 2.1.2)
      gyoku (>= 0.4.0)
      httpi (>= 0.7.8)
      nokogiri (>= 1.4.0)
      nori (>= 0.2.0)
    thor (0.14.6)
    treetop (1.4.9)
      polyglot (>= 0.3.1)
    tzinfo (0.3.27)
    xml-simple (1.0.15)
    yaml_db (0.2.1)

PLATFORMS
  ruby

DEPENDENCIES
  authlogic
  aws-s3
  cancan
  composite_primary_keys (= 3.1.0)
  engineyard
  json
  mime-types
  mysql
  nokogiri
  paperclip
  rails (= 3.0.7)
  rapns
  savon
  yaml_db

Segmentation fault when running in foreground

Hi there.

Two questions:

  1. I'm afraid I'm getting a segmentation fault when running rapns in the foreground. It looks like it's occurring when connecting to the apple dev gateway (trace below).

  2. On the other hand, when I tried to run the daemon in the background, I do see (albeit only 2x) entries saying I'm connected to the gateway. Strange thing is that if I re-run the background daemon more times I don't see anymore log entries that I have connected (again, only 2 log entries).

I'm using Ruby 1.9.2.

Trace for 1) (above):


$ bundle exec rapns development --foreground
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:80: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32478) [x86_64-darwin11.0.1]

-- control frame ----------
c:0016 p:---- s:0053 b:0053 l:000052 d:000052 CFUNC  :connect
c:0015 p:0136 s:0050 b:0050 l:000049 d:000049 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:80
c:0014 p:0023 s:0045 b:0045 l:000044 d:000044 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:14
c:0013 p:0013 s:0042 b:0042 l:000041 d:000041 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/delivery_handler.rb:27
c:0012 p:0012 s:0039 b:0039 l:000038 d:000038 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/delivery_handler_pool.rb:12
c:0011 p:0042 s:0035 b:0035 l:000025 d:000034 BLOCK  /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/pool.rb:13
c:0010 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0009 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :times
c:0008 p:0013 s:0026 b:0026 l:000025 d:000025 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/pool.rb:10
c:0007 p:0297 s:0023 b:0023 l:000022 d:000022 METHOD /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon.rb:46
c:0006 p:0180 s:0018 b:0018 l:002270 d:002270 TOP    /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/bin/rapns:28
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :load
c:0003 p:0127 s:0007 b:0007 l:002198 d:0002c0 EVAL   /Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/bin/rapns:19
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:002198 d:002198 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/bin/rapns:19:in `'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/bin/rapns:19:in `load'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/bin/rapns:28:in `'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon.rb:46:in `start'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/pool.rb:10:in `populate'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/pool.rb:10:in `times'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/pool.rb:13:in `block in populate'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/delivery_handler_pool.rb:12:in `object_added_to_pool'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/delivery_handler.rb:27:in `start'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:14:in `connect'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:80:in `connect_socket'
/Users/smthmarketable/.rvm/gems/ruby-1.9.2-head/gems/rapns-1.0.1/lib/rapns/daemon/connection.rb:80:in `connect'

-- C level backtrace information -------------------------------------------

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

Any ideas?

Can't push messages containing colons

This is a bug in RAPNS 1.0.2.

Messages are actually delivered, and they arrive at the device, but they only make a sound/vibrate -- they don't appear on screen, display any text, appear in the notification center, or launch the app when unlocked.

This only happens when the message contains colons. Strip out the colons and everything is golden.

rapns fails to start on Heroku with ActiveRecord 3.2.5

Due to this commit in ActiveRecord rapns fails to start with ActiveRecord 3.2.4/3.2.5 on Heroku.
rails/rails@8e315b0

lib/rapns/patches.rb:

if ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'postgresql'

It fails as there is no 'configurations' available: lib/rapns/patches.rb:1:in '<top (required)>': undefined method '[]' for nil:NilClass (NoMethodError)

I don't have a pull request right now, but I think you should also check for the ENV['DATABASE_URL'].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.