Hi there, I've noticed a strange problem in my app that seems to only occur under passenger when passenger is restarted for a few minutes:
As most people do, I have cached regularly called methods in ApplicationController like so:
def context return @context if @context
case request.path when /^\/admin/ :admin when /^\/manage/ @context = :manage else @context = nil end end
It's a normal pattern, return @context if that exists, otherwise calculate it based upon the URL. I'd expect the normal behaviour to be that this gets calculated once per request the first time context is called, and then it would return @context from then on.
The problem is that it seems like these instance variables are leaking between requests. I get errors relating to @context still being :admin even though the request path isn't an admin path. The only reason for this seems to be that the variables are being kept around for the next request. The problem seems to go away after passenger has been running for a few minutes.
Since this problem seems quite ethereal and hard to pin down I thought I'd post this here and see if anyone else has had any problems like this?
Looking forward to hearing from you
Cheers,
Brendon