You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by ApacheNinja <dp...@gmail.com> on 2013/10/08 15:39:03 UTC

shiro-activeSessionCache.data file has become extremely large (2GB)

Hello,

In our root directory on our web server there is a /tmp folder.   Inside the
tmp folder is another folder called shiro-ehcache.  The file inside
shiro-activeSessionCache.data has grown to almost 2GB in one day.  We have
restrictions on our server and if contents in the folder become too big then
IT receives warnings.  I was not aware that Shiro was writing to the /tmp
directory.   Is there a reason why this would be happening all of a sudden? 
We are using EhCache when setting the cache on the security manager.  Would
it be Shiro doing this or EhCache?  Any help would be greatly appreciated. 
Thank you.



--
View this message in context: http://shiro-user.582556.n2.nabble.com/shiro-activeSessionCache-data-file-has-become-extremely-large-2GB-tp7579227.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: shiro-activeSessionCache.data file has become extremely large (2GB)

Posted by ApacheNinja <dp...@gmail.com>.
After further investigation, it appears that it ran out of memory and thus
had to write to disk.  It is unclear why this would all of a sudden start
happening though.  

These are the settings for our Shiro session cache in our ehcache.xml file:

   <cache name="shiro-activeSessionCache"
       		maxElementsInMemory="10000"
       		overflowToDisk="true"
       		eternal="true"
      		timeToLiveSeconds="0"
       		timeToIdleSeconds="0"
       		diskPersistent="false"
      		diskExpiryThreadIntervalSeconds="600"
      	 	>
    </cache>

I was contemplating turning off session caching but I believe that made the
application slower when attempted previously.  Any suggestions on fine
tuning this so that I don't consistently have a huge log file?



--
View this message in context: http://shiro-user.582556.n2.nabble.com/shiro-activeSessionCache-data-file-has-become-extremely-large-2GB-tp7579227p7579229.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: shiro-activeSessionCache.data file has become extremely large (2GB)

Posted by ApacheNinja <dp...@gmail.com>.
Here is how we are initializing everything programmatically:

public static void initSecurityManager() {
		 
		        //Set realms
			mSecurityManager = new DefaultSecurityManager();
			mSecurityManager.setAuthenticator(new MockAuthenticator());
			ArrayList <Realm> realms = new ArrayList<Realm>();
			realms.add(new PortalRealm());
			realms.add(new PortalBaselineRealm());
			mSecurityManager.setRealms(realms);
			
			//Setup caching
			SessionDAO sessionDAO = new EnterpriseCacheSessionDAO();
		
((DefaultSessionManager)mSecurityManager.getSessionManager()).setSessionDAO(sessionDAO);
			EhCacheManager shiroCacheManager = new EhCacheManager();
			mSecurityManager.setCacheManager(shiroCacheManager); 
		
		  //Set session timeout	

((DefaultSessionManager)mSecurityManager.getSessionManager()).setGlobalSessionTimeout(28800000);
			
			SecurityUtils.setSecurityManager(mSecurityManager);
	 }
	  



--
View this message in context: http://shiro-user.582556.n2.nabble.com/shiro-activeSessionCache-data-file-has-become-extremely-large-2GB-tp7579227p7579228.html
Sent from the Shiro User mailing list archive at Nabble.com.