1
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).

Mark Fraser
  • 3,160
  • 2
  • 29
  • 48
  • Hi, i had this problem once. I could not cache a hashmap. I posted a question [here](http://stackoverflow.com/questions/11197844/is-there-a-way-to-cache-a-hashmap-in-ruby-on-rails). I changed it into array and then i was able to dump it – user1455116 Sep 28 '12 at 13:47
  • I am not using a hash map. I have images, css and javascript files, just like virtually every other rails app ever made. So this is either a recently introduced bug or something else about my app that is different. If someone can tell me what I should be looking for, I would appreciate it. – Mark Fraser Sep 28 '12 at 14:05
  • I have the same problem. I think it is not connected with assets, I have this exception on production where assets are served via apache. It seems to not have any functional impact on application. I tried also newer JRuby versions, up to 1.7.0.RC1, it doesn't change anything. – cthulhu Sep 28 '12 at 14:54
  • Is seems to be trinidad specific, because WEBrick on JRuby seems to work fine (or maybe it is swallowing that kind of exceptions - trinidad is logging things a little bit different) – cthulhu Sep 28 '12 at 14:57
  • Yes I think you are right about Trinidad. I updated the question to include that information. – Mark Fraser Sep 28 '12 at 16:14

0 Answers0