Rails (jruby) cache error (Can't dump hash with default proc) when caching assets

529 Views Asked by At
Ruby version: jruby-1.6.8
Rails version 3.2.6
Server: trinidad

I am having an error in my log in production mode whenever an asset (image, CSS or JS) is served where it is not cached (i.e. when it's in the browser cache the app is sending a 304 and the error isn't happening).

It does not happen when I run the application under WEBrick instead of Trinidad.

The error also occurs in development mode when I set:

config.action_controller.perform_caching = true

The error that appears in the log is as follows:

Started GET "/assets/pokervane_128-ade771fc66f43a240b500e874c6de23b.png" for 127.0.0.1        at Fri Sep 28 08:41:19 -0400 2012
2012-09-28 08:41:19 -0400 INFO: Served asset /pokervane_128-ade771fc66f43a240b500e874c6de23b.png - 200 OK (0ms)
2012-09-28 08:41:19 -0400 INFO: cache error: can't dump hash with default proc
org/jruby/RubyMarshal.java:101:in `dump'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/actionpack-3.2.6/lib/action_dispatch/http/rack_cache.rb:25:in `write'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/metastore.rb:83:in `store'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/context.rb:267:in `store'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/context.rb:259:in `fetch'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/railties-3.2.6/lib/rails/engine.rb:479:in `call'
/Users/mark/.rvm/gems/jruby-1.6.8/gems/railties-3.2.6/lib/rails/application.rb:220:in `call'
file:/Users/mark/.rvm/gems/jruby-1.6.8/gems/jruby-rack-1.1.10/lib/jruby-rack-1.1.10.jar!/rack/handler/servlet.rb:22:in `call'

My application does not use active record (I used --skip-active-record when I created it). In order to rule out that this fact is related I made a copy of my app, added back:

require active_record/railtie

to application.rb, and created a database. This did not get rid of the error.

Does anyone have a suggestion on what I can do to get rid of this error (other than turning off caching, of course).

0

There are 0 best solutions below