问题
I'm getting following warning and I have no idea what to do about it. There is about 80000 entries that write this warning into catalina.out log file in tomcat every time the bannedIPs are getting updated:
WARNING: Cache package.BannedIP Key package.BannedIP#73121 Lockable : null
A soft-locked cache entry was expired by the underlying Ehcache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
Dec 16, 2010 10:00:53 PM net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy handleLockExpiry
The configuration for BannedIP in ehcache.xml file:
<cache name="package.BannedIP"
maxElementsInMemory="80000"
eternal="true"
overflowToDisk="true"
diskPersistent="true" />
Any help will be appreciated.
回答1:
Are you experiencing any performance or usability problems as a result of this warning? If not then it seems like you should treat this warning as just that: a warning.
Otherwise, it looks like the solution is to increase the size of maxElementsInMemory
to account for the difference in what is cached versus what is realistically being used.
Hope this helps.
回答2:
Have you yet made sure the package.BannedIP is actually containing what you expect ?
You could programmatically use the Statistics to see what's going on. Given the configuration bit you have there, Ehcache should never evict anything (as long as you have less than 80k BannedIP instances).
Also, to be clear about what that message means: you are in the process of updating a BannedIP instances but, when the commit happens, the SoftLock that Hibernate has put in place to mark this entry has being in the process of being updated, has been evicted for some reason... I wonder why these updates take so long ?
Also, though I'm just thinking out loud, could it be some other process (bulk update) is invalidating the whole cache region ?
来源:https://stackoverflow.com/questions/4576939/problems-with-a-soft-locked-cache-entry-was-expired-by-the-underlying-ehcache