activerecord-postgres-hstore icon indicating copy to clipboard operation
activerecord-postgres-hstore copied to clipboard

Deserialization issue

Open HuckyDucky opened this issue 10 years ago • 1 comments

This is Rails 3.2.

I'm getting the following error, but only when the method is executed via Sidekiq:

2014-08-14T15:14:25.255Z 23335 TID-ovtw9n32c WARN: undefined method `scan' for {}:Hash
2014-08-14T15:14:25.255Z 23335 TID-ovtw9n32c WARN: /Users/me/myapp/code/myfitment/.gems/ruby/1.9.1/gems/pg-hstore-1.2.0/lib/pg_hstore.rb:24:in `load`

It's triggered two ways:

  1. By referencing the HStore field on the model instance
  2. By calling "save" on the model instance

The error does not occur in the console. This tells me it is some kind of deserialization issue coming from Sidekiq. I can't decide whether Sidekiq is doing the serialization of the HStore field wrong, or if activerecord-postgres-hstore is doing the deserialization wrong.

The workaround is to call "self.reload" in the model instance method that is executed via Sidekiq's "delay" method.

HuckyDucky avatar Aug 14 '14 15:08 HuckyDucky

Looks like this was cross-posted and answered on https://github.com/mperham/sidekiq/issues/1899

gingerlime avatar Sep 14 '14 06:09 gingerlime