Bunny: undefined method decode_payload for HeartbeatFrame

47 views
Skip to first unread message

Guilherme Cavalcanti

unread,
Apr 22, 2013, 6:53:54 AM4/22/13
to ruby...@googlegroups.com
Hello guys,

I have a Rails (3.0.20) app running in production which sets up callbacks  to ActiveRecord objects. Those callbacks are called every time a model gets created or saved to the database. For this I use de untied-publisher gem [1].

Sometimes when the callbacks are invoked from a Delayed::Job I get this error:

undefined method `decode_payload' for #<AMQ::Protocol::HeartbeatFrame:0xaf5abb6c>

Here is the stacktrace:

…ms/ruby/1.8/gems/bunny-0.9.0.pre8/lib/bunny/session.rb: 658:in `open_connection'
…ms/ruby/1.8/gems/bunny-0.9.0.pre8/lib/bunny/session.rb: 160:in `start'
…isher-0.0.7.pre/lib/untied-publisher/bunny/producer.rb:  11:in `initialize'
…d-publisher-0.0.7.pre/lib/untied-publisher/observer.rb:  38:in `new'
…d-publisher-0.0.7.pre/lib/untied-publisher/observer.rb:  38:in `producer'
…d-publisher-0.0.7.pre/lib/untied-publisher/observer.rb:  34:in `produce_event'
…d-publisher-0.0.7.pre/lib/untied-publisher/observer.rb:  22:in `method_missing'
…publisher-0.0.7.pre/lib/untied-publisher/doorkeeper.rb:  97:in `send'
…publisher-0.0.7.pre/lib/untied-publisher/doorkeeper.rb:  97:in `_notify_untied__publisher__observer_for_after_update'
…3a9b0407/activesupport/lib/active_support/callbacks.rb: 427:in `_run_update_callbacks'
…403a9b0407/activerecord/lib/active_record/callbacks.rb: 281:in `update'
…3a9b0407/activerecord/lib/active_record/persistence.rb: 257:in `create_or_update'
…403a9b0407/activerecord/lib/active_record/callbacks.rb: 273:in `create_or_update'
…3a9b0407/activesupport/lib/active_support/callbacks.rb: 429:in `_run_save_callbacks'
…403a9b0407/activerecord/lib/active_record/callbacks.rb: 273:in `create_or_update'
…3a9b0407/activerecord/lib/active_record/persistence.rb:  40:in `save'
…3a9b0407/activerecord/lib/active_record/validations.rb:  43:in `save'
…iverecord/lib/active_record/attribute_methods/dirty.rb:  21:in `save'
…a9b0407/activerecord/lib/active_record/transactions.rb: 240:in `save'
…a9b0407/activerecord/lib/active_record/transactions.rb: 292:in `with_transaction_returning_status'
…rd/connection_adapters/abstract/database_statements.rb: 139:in `transaction'
…a9b0407/activerecord/lib/active_record/transactions.rb: 207:in `transaction_ActiveRecord_self_name_transaction'
…a9b0407/activerecord/lib/active_record/transactions.rb: 290:in `with_transaction_returning_status'
…a9b0407/activerecord/lib/active_record/transactions.rb: 240:in `save'
…a9b0407/activerecord/lib/active_record/transactions.rb: 251:in `rollback_active_record_state!'
…a9b0407/activerecord/lib/active_record/transactions.rb: 239:in `save'
…/redu/releases/20130421224123/app/models/enrollment.rb:  51:in `update_grade!'
…ems/ruby/1.8/gems/bunny-0.9.0.pre8/lib/bunny/socket.rb:  29:in `to_proc'
…b/active_record/associations/association_collection.rb: 431:in `method_missing'
…rd/lib/active_record/associations/association_proxy.rb: 225:in `method_missing'
…rd/lib/active_record/associations/association_proxy.rb: 225:in `map'
…rd/lib/active_record/associations/association_proxy.rb: 225:in `send'
…rd/lib/active_record/associations/association_proxy.rb: 225:in `method_missing'
…b/active_record/associations/association_collection.rb: 431:in `method_missing'
…ata/redu/releases/20130421224123/app/models/lecture.rb: 144:in `create_asset_report'
…ses/20130421224123/app/jobs/create_asset_report_job.rb:  11:in `perform'

The perform method is very simple:

  def initialize(opts)
    @lecture_id = opts[:lecture_id]
  end
  def perform
    lecture = Lecture.find_by_id(@lecture_id)
    lecture.create_asset_report if lecture
  end

The error not always happens (28 times out of 445 on the last 7 days). Any clue about this error?

Michael Klishin

unread,
Apr 22, 2013, 7:02:27 AM4/22/13
to ruby...@googlegroups.com
2013/4/22 Guilherme Cavalcanti <guiocav...@gmail.com>

Sometimes when the callbacks are invoked from a Delayed::Job I get this error:

undefined method `decode_payload' for #<AMQ::Protocol::HeartbeatFrame:0xaf5abb6c>

Here is the stacktrace:

…ms/ruby/1.8/gems/bunny-0.9.0.pre8/lib/bunny/session.rb: 658:in `open_connection'

It means that somehow RabbitMQ delivered a heartbeat frame before the connection was opened.

Michael Klishin

unread,
Apr 22, 2013, 7:04:06 AM4/22/13
to ruby...@googlegroups.com
2013/4/22 Michael Klishin <michael....@gmail.com>

It means that somehow RabbitMQ delivered a heartbeat frame before the connection was opened.

Bump heartbeat period to at least a few seconds and it should be gone.

Guilherme Cavalcanti

unread,
Apr 22, 2013, 7:25:43 AM4/22/13
to ruby...@googlegroups.com
Thanks, I'll try that.
Reply all
Reply to author
Forward
0 new messages