amazon-archives / aws-dynamodb-session-tomcat

ARCHIVED: Amazon DynamoDB based session store for Apache Tomcat
Apache License 2.0
95 stars 73 forks source link

Any reason this shouldn't work with Grails3 on Tomcat8 #36

Open walshe opened 8 years ago

walshe commented 8 years ago

http://stackoverflow.com/questions/35081392/using-aws-dynamodb-ro-save-session-inormation-in-grails-3

shorea commented 8 years ago

This looks like a bug. ExpiredSessionReaper should occasionally be polling for thread status and abort in a timely fashion.

"I'm hoping that once I have dynamodb backing the httpsession that I can spin up as many instances of my web app as possible and still have user sessions work across different servers without relying on 'sticky' sessions etc." Not sure if you're the same poster as the StackOverflow question but this implementation of session manager still requires sticky sessions unfortunately. It is similar to the JDBC and File session stores and only persists idle sessions and acts as a session backup rather then realtime persistence.

walshe commented 8 years ago

is there any way of getting around stickyness or is it generally used ? or do most apps these days always just use oauth2 for a completly stateless model

shorea commented 8 years ago

"is there any way of getting around stickyness or is it generally used?" Unfortunately due to the design of the session manager it is not possible to use non-sticky sessions. There is a memcached session manager that supports non-sticky sessions. https://github.com/magro/memcached-session-manager

"Or do most apps these days always just use oauth2 for a completly stateless mode?" I'm not sure, I am not familiar with oauth2.

westonlast commented 8 years ago

Assuming this Issue is actually about the memory leak on un-deployment caused by the "ExpiredSessionReaper," here's some more information:

SEVERE: The web application [] appears to have started a thread named [dynamo-session-manager-expired-sesion-reaper] but has failed to stop it. This is very likely to create a memory leak.

The ExecutorService associated with ExpiredSessionReaperExecutor is never shutdown(): https://github.com/aws/aws-dynamodb-session-tomcat/blob/v2.0.1/src/main/java/com/amazonaws/services/dynamodb/sessionmanager/DynamoDBSessionManager.java#L143

For example, on PersistentManagerBase.stopInternal(), something like this:

scheduledThreadPoolExecutor.shutdown();

try{
    if(!scheduledThreadPoolExecutor.awaitTermination(1, TimeUnit.MINUTES)){
        scheduledThreadPoolExecutor.shutdownNow();
    }
}
catch(InterruptedException e){
    scheduledThreadPoolExecutor.shutdownNow();
}

https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/session/PersistentManagerBase.html

eschulma commented 6 years ago

Is this likely to be fixed any time?

hyandell commented 6 years ago

This project has been archived. Please see the README.md for more detail on alternative projects.