Padrino: "incompatible marshal file format (can't be read)"

If you see a stacktrace beginning with lines like this:

E, [2015-07-16T09:23:10.896146 #23308] ERROR -- : app error: "incompatible marshal file format (can't be read)\n\tformat version 4.8 required; 32.32 given" (TypeError)
E, [2015-07-16T09:23:10.896282 #23308] ERROR -- : /.../bundle/ruby/2.0.0/gems/moneta-0.7.20/lib/moneta/transformer.rb:132:in `load'
E, [2015-07-16T09:23:10.896311 #23308] ERROR -- : /.../bundle/ruby/2.0.0/gems/moneta-0.7.20/lib/moneta/transformer.rb:132:in `load'
E, [2015-07-16T09:23:10.896334 #23308] ERROR -- : /.../bundle/ruby/2.0.0/gems/moneta-0.7.20/lib/moneta/proxy.rb:47:in `load'
...

It is very likely you updated Padrino (as we did from 0.11.x to 0.12.x). Also, it is very likely you use fragment caching (or basically any Padrino cache) that in turn stores cached content externally, i.e. not within a tmp directory that gets cleared after each deployment.
You might use Redis or Memcache as external cache store. See config/boot.rb for details.

In that case, you should clear your cache entirely after deploying your new code. Why? Your new code will see old cache fragments, marshaled using your old version of Padrino that is incompatible with the new one.

You can clear your caches within a Pardino console running
Your::App.cache.clear

If you want to dive deeper, you can look inside your cache store. For Redis, run redis_cli to connect to your Redis host. You can see your cache content by running keys "$your_cache_key". You can retrieve the content with get "$your_cache_key" in case you're interested what is cached. Run del "$your_cache_key" to remove the key.

Thomas Eisenbarth Almost 9 years ago