-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SESSION_CACHE_DURATION no longer supports a "never expire" value #187
Comments
Hi @dotasek - sorry for the ping but we were hoping to get your thoughts on this. Inferno is trying to stay up-to-date with the validator wrapper so that results in a test kit match what a user might get on validator.fhir.org, but this unintended change has us on pause for the moment. At minimum for us we we could add a one-liner right after this Line 27 in 29c4ce6
something like: if (sessionCacheDuration == -1) sessionCacheDuration = Long.MAX_VALUE But that would only address the -1 case, not the 0 case. It may be simple enough to restore the 0 case as well but I haven't had time to explore. (Frankly I'm not sure the 0 case even makes sense in a tool like this but I documented it as an option in all our test kits) The other option I see would be to make the session cache implementation choice based on another env var - by default it could use the new Guava cache but we could set it back to the PassiveExpiringSessionCache if needed. Do you have a preference? Or any other thoughts on this |
@dehall SESSION_CACHE_DURATION used to be bound to PassiveExpiringMap from apache commons, which is what specified those values of -1 and 0. I don't think I realized while making the change that there were special values, and I just focused on the duration as a time value. I was honestly hoping I could let PassiveExpiringMap die after starting to use Guava, but I guess this is not to be. I think your suggestion of making the session cache implementation based on env var is a good one. I can implement it, but I will be out until Oct 15.
From now on, those ENV variables will be treated like API, but I think we need a better solution for configuring session caches in the future. |
Sounds good, thanks! If you really want to get rid of PassiveExpiringMap altogether, I can spend a little more time looking into how to get an "always expire" value in the Guava cache as well. If nothing stands out though I'll send a PR for this new env var. (probably Monday) |
Upon closer inspection, turns out the 0 setting didn't work on previous versions either. The issue is this sequence in String sessionId = this.initializeValidator(request.getCliContext(), (String)null, timeTracker, request.sessionId);
ValidationEngine validationEngine = this.sessionCache.fetchSessionValidatorEngine(sessionId); The session is created in So the only remaining aspect is how can we re-enable a "never expire" setting. Since you want to get rid of the PassiveExpiringMap I'll submit a one-liner PR to translate negative numbers into large numbers. Edit: I submitted both approaches so you can choose the one you prefer |
In previous releases (up to 1.0.52 at least) the env var SESSION_CACHE_DURATION, which specifies how long sessions will remain in the cache before they are purged due to inactivity, could be set to a negative value for "sessions never expire" or 0 for "sessions always expire". (Per the notes on the
PassiveExpiringMap
used https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/map/PassiveExpiringMap.html#%3Cinit%3E(long) )Testing on the 1.0.55 docker image, using a negative value causes an error at startup:
and using 0 (which per the Guava docs seems like it should be the new "never expire" https://guava.dev/releases/19.0/api/docs/com/google/common/cache/CacheBuilder.html#expireAfterAccess(long,%20java.util.concurrent.TimeUnit) ) the server starts but trying to create a session fails:
It's not a huge deal to specify a large value instead to mean "never expire" but all of the Inferno test kits that use this validator-wrapper are currently set on -1 so it's a lot of repos to update . It would be great if we could keep the semantics of this env var consistent.
The text was updated successfully, but these errors were encountered: