ileitch / rapns

MOVED TO https://github.com/rpush/rpush
MIT License
289 stars 92 forks source link

ActiveRecord::StatementInvalid, SQLite3::SQLException: no such column: true #160

Closed pyramid-seph closed 11 years ago

pyramid-seph commented 11 years ago

Lately I've been getting a lot of:

ActiveRecord::StatementInvalid, SQLite3::SQLException: no such column: true: UPDATE "rapns_notifications" SET delivered = true, delivered_at = '2013-09-04 19:08:57.974567' WHERE "rapns_notifications"."id" IN (NULL)
[2013-09-04 14:08:57] [ERROR] ActiveRecord::StatementInvalid, SQLite3::SQLException: no such column: true: UPDATE "rapns_notifications" SET delivered = true, delivered_at = '2013-09-04 19:08:57.974567' WHERE "rapns_notifications"."id" IN (NULL)
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `initialize'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `new'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `prepare'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:246:in `block in exec_query'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:242:in `exec_query'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:268:in `exec_delete'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:96:in `update'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `update'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/relation.rb:294:in `update_all'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/store/active_record.rb:46:in `block in mark_batch_delivered'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/store/active_record/reconnectable.rb:18:in `block in with_database_reconnect_and_retry'
 /Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/store/active_record/reconnectable.rb:17:in `with_database_reconnect_and_retry'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/store/active_record.rb:45:in `mark_batch_delivered'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:81:in `complete_delivered'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:69:in `block in complete'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:67:in `each'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:67:in `complete'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:52:in `block in notification_processed'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:50:in `synchronize'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:50:in `notification_processed'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/delivery_handler.rb:47:in `handle_next_notification'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/delivery_handler.rb:13:in `block (2 levels) in start'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/delivery_handler.rb:12:in `loop'
/Users/touchtastic/.rvm/gems/ruby-2.0.0-p247@my_app/gems/rapns-3.4.1/lib/rapns/daemon/delivery_handler.rb:12:in `block in start'

[2013-09-04 14:08:57] [WARNING] Lost connection to database, reconnecting... [2013-09-04 14:08:57] [WARNING] Attempt 1 [2013-09-04 14:08:57] [WARNING] Database reconnected

on rapns.log . Rapns keeps trying to execute this update until I kill its process.

EDIT: The push message is not being send. Notification is not saved.

"true" is not interpreted as a column on mysql.

I'm using rapns 3.4.1 .

mattconnolly commented 11 years ago

It looks like you're using Sqlite not mysql, is that correct?

pyramid-seph commented 11 years ago

I'm using Sqlite for development and Mysql for production.

ileitch commented 11 years ago

sqlite isn't a good choice for rapns, none the less, it should still work for development purposes. I'm working on a fix for this now.

pyramid-seph commented 11 years ago

I have edited the issue description. Notification is not saved, so the push message is never send.

reejosamuel commented 11 years ago

This issue is still showing in gem version * rapns (3.4.1)

ileitch commented 11 years ago

This is fixed in master, but not currently released. 3.4.2 will contain the fix.

fabiovena commented 11 years ago

Could you please release 3.4.2. This would avoid the annoying errors during development. Thanks.