Rack-cache key problems after moving to jruby+glassfish

7 views
Skip to first unread message

KD

unread,
Aug 13, 2009, 11:58:58 AM8/13/09
to rack-cache
I have a Sinatra app I ported from plain old window ruby and mongrel
to jruby + glassfish. Porting was almost entirely just installing the
new software (though I was using rest-client and it doesn't work at
all and rack-cache isn't working which is why I'm here).

It is working like a champ if I disable rack-cache. If I enable it I
get exceptions in the write call and I think it is because for some
reason in the new environment rack-cache.cache_key is set wrong. I
have key's that look like this: '://localhost/testpackage?'. Seems
like that is the request.url, not the request.path_info, and maybe it
should be using request.path_info?

I see some code in the gem suggesting I can somehow set :cache_key.
How might I do this and where?

Thanks,
KD.

KD

unread,
Aug 13, 2009, 12:56:08 PM8/13/09
to rack-cache
It appears the problem is that in jruby+glassfish under Windows,
IOError is thrown instead of ENOENT. Since rack-cache expects this
exception and codes in the rescue of read/write/purge, these
operations will fail.

KD

unread,
Aug 13, 2009, 3:45:04 PM8/13/09
to rack-cache
If directory foo does not exist, and you run the following on ruby
under windows and jruby under windows you get different exceptions:

path = 'C:/foo/bar'
begin
File.open(path, 'wb') { |f| Marshal.dump('hello, foo', f) }
rescue IOError => err
puts err.inspect # jruby does this
rescue Errno::ENOENT => err
puts err.inspect # ruby does this
end
Reply all
Reply to author
Forward
0 new messages