sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
504 stars 40 forks source link

NotImplementedError: method 'div' called on terminated object" #23

Closed findchris closed 8 years ago

findchris commented 8 years ago

Hello again.

In the last 12 hours, I've seen the following error about 10 times:

NotImplementedError: method `div' called on terminated object (0x007f948aef8028 flags=0x0 klass=0x0)
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/entity.rb:67 in new
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/entity.rb:67 in load
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/entity.rb:67 in load
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:71 in block in read
vendor/bundle/ruby/2.1.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64 in block (2 levels) in with
vendor/bundle/ruby/2.1.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63 in handle_interrupt
vendor/bundle/ruby/2.1.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63 in block in with
vendor/bundle/ruby/2.1.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60 in handle_interrupt
vendor/bundle/ruby/2.1.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60 in with
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:346 in block in invoke
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:341 in block in instrument
vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166 in instrument
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:341 in instrument
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:345 in invoke
vendor/bundle/ruby/2.1.0/bundler/gems/readthis-a774c6278aab/lib/readthis/cache.rb:68 in read

I am using the Oj serializer, and since it feels like a "use after free" condition, I figured it might be the C code in use by Oj, so I opened https://github.com/ohler55/oj/issues/265.

I wanted to open this in case you might have encountered this and/or have any insight into debugging/resolving it. Unfortunately, I haven't been able to reproduce yet.

Cheers.

sorentwo commented 8 years ago

Is it possible that you have previously cached template data? It seems like Oj may be trying to parse some data that isn't actually json.

If you deployed the 1.x series over old data that didn't have any serializer flags it wouldn't properly choose the right serializer for entity loading.

findchris commented 8 years ago

I'm convinced this is an Oj issue, as I don't know how readthis might be generating this error beyond its usage of Oj.

To your question, this was my first deploy to production of code using readthis, so it's not a readthis versioning issue. The old cache had ActiveSupport::Cache::Entrys stored, which raised a different Oj parse error.