You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Charles Syperski <cs...@dupage88.net> on 2012/08/30 17:46:54 UTC

Controlling sizeOfPolicy on shiro-activeSessionCache

I am wondering if it possible to control the sizeOfPolicy on 
shiro-activeSessionCache?  I am using shiro with terracotta, but I am 
not sure how I can change the 'behavior' and the 'maxDepth'? Here is my 
current config:

<cache name="shiro-activeSessionCache"
            overflowToDisk="false"
            eternal="true"
            timeToLiveSeconds="0"
            timeToIdleSeconds="0"
            maxBytesLocalHeap="100M"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="600">
         <sizeOfPolicy maxDepthExceededBehavior="abort" maxDepth="500" />
         <terracotta>
             <nonstop immediateTimeout="false" timeoutMillis="30000">
                 <timeoutBehavior type="exception" />
             </nonstop>
         </terracotta>
     </cache>

Yet I am still seeing:

WARN ObjectGraphWalker:209 - The configured limit of 1,000 object 
references was reached while attempting to calculate the size of the 
object graph. Severe performance degradation could occur if the sizing 
operation continues. This can be avoided by setting the CacheManger or 
Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or 
adding stop points with @IgnoreSizeOf annotations. If performance 
degradation is NOT an issue at the configured limit, raise the limit 
value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth 
attribute. For more information, see the Ehcache configuration 
documentation.

As a result, I am getting alot of:

  ERROR AbstractShiroFilter:317 - session.touch() method invocation has 
failed.  Unable to updatethe corresponding session's last access time 
based on the incoming request.
org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: 
net.sf.ehcache.CacheException: java.util.ConcurrentModificationException
     at org.apache.shiro.cache.ehcache.EhCache.put(EhCache.java:105)
     at 
org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:247)
     at 
org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:235)
     at 
org.apache.shiro.session.mgt.eis.CachingSessionDAO.update(CachingSessionDAO.java:280)
     at 
org.apache.shiro.session.mgt.DefaultSessionManager.onChange(DefaultSessionManager.java:212)
     at 
org.apache.shiro.session.mgt.AbstractNativeSessionManager.touch(AbstractNativeSessionManager.java:190)



Which am assuming is because I am attempting to access the same 
collection that the ObjectGraphWalker is attempting to access.

Is there any way to set the sizeOfPolicy either via ehcache.xml or via 
shiro.ini?

Thanks