[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
outofmemoryerror using ehcache 4.1.2 snapshot  XML
Forum Index -> Ehcache
Author Message
rbkaer

neo

Joined: 03/05/2012 03:46:00
Messages: 6
Offline

Hello all,

I am having a problem using the hibernate-ehcache 4.1.2 snapshot. Tha caches seem to be working well at first, but then after approximately 2 days, i start top get outofmemoryerrors, which seem to be originating when i attempt to retrieve objects from a cache.

The stack trace is as follows:
Code:
 [2012-03-22 16:16:06,823] WARN605927[http-bio-80-exec-897] - net.sf.ehcache.constructs.web.filter.Filter.logThrowable(Filter.java:138) - Throwable thrown during doFilter on request with URI: /ihq/admin/site_tree and Query: _dc=1332432966759&node=Request processing failed; nested exception is net.sf.ehcache.CacheException: net.sf.ehcache.CacheException: Uncaught exception in get() - PermGen space
 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is net.sf.ehcache.CacheException: net.sf.ehcache.CacheException: Uncaught exception in get() - PermGen space
 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
 	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	atcom.example.webmanager.filter.PagePreviewFilter.doFilter(PagePreviewFilter.java:62)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(GzipFilter.java:95)
 	at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at com.example.commons.filters.HttpHeadFilter.doFilter(HttpHeadFilter.java:47)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
 	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
 	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
 	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
 	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
 	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:681)
 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
 	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
 	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
 	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 	at java.lang.Thread.run(Thread.java:636)
 Caused by: net.sf.ehcache.CacheException: net.sf.ehcache.CacheException: Uncaught exception in get() - PermGen space
 	at net.sf.ehcache.constructs.nonstop.NonstopExecutorServiceImpl.execute(NonstopExecutorServiceImpl.java:101)
 	at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.executeWithExecutor(ExecutorServiceStore.java:160)
 	at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.executeWithExecutor(ExecutorServiceStore.java:129)
 	at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.get(ExecutorServiceStore.java:411)
 	at net.sf.ehcache.constructs.nonstop.store.NonstopStoreImpl.get(NonstopStoreImpl.java:344)
 	at net.sf.ehcache.Cache.searchInStoreWithStats(Cache.java:1986)
 	at net.sf.ehcache.Cache.get(Cache.java:1618)
 	at net.sf.ehcache.Cache.get(Cache.java:1591)
 	at com.example.webmanager.logic.tree.TreeCacheManager.getFromCache(TreeCacheManager.java:102)
 	at com.example.webmanager.logic.tree.TreeService.buildBranch(TreeService.java:28)
 	at com.example.webmanager.controller.admin.TreeController.getTreeJson(TreeController.java:42)
 	at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 	at java.lang.reflect.Method.invoke(Method.java:616)
 	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
 	... 59 more
 Caused by: net.sf.ehcache.CacheException: Uncaught exception in get() - PermGen space
 	at org.terracotta.modules.ehcache.store.ClusteredSafeStore.get(ClusteredSafeStore.java:685)
 	at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore$12.call(ExecutorServiceStore.java:413)
 	at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore$12.call(ExecutorServiceStore.java:411)
 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 	at net.sf.ehcache.constructs.nonstop.NonstopThreadPool$WorkerThreadLocal$1.run(NonstopThreadPool.java:180)
 	at net.sf.ehcache.constructs.nonstop.NonstopThreadPool$Worker.run(NonstopThreadPool.java:222)
 	... 1 more
 



apparntly from this, it is being caused by the a cache retrieval from something we call the "privateTreeCache". Its config is as follows:

Code:
<cache name="privateTreeCache" maxElementsInMemory="5000" maxElementsOnDisk="100000" eternal="false"
 		timeToLiveSeconds="3600" overflowToDisk="false" statistics="true">
 		<terracotta>
 			<nonstop>
 				<timeoutBehavior type="noop" />
 			</nonstop>
 		</terracotta>
 	</cache>
rmahajan

journeyman

Joined: 12/28/2011 21:53:45
Messages: 47
Offline

How much memory you are starting your process with ? Can you please let us know what are your Xmx Xms settings ?

Depending on your memory usage and size of an individual object in cache, you might have to tune the number of objects you are keeping in memory i.e : maxElementsInMemory
rbkaer

neo

Joined: 03/05/2012 03:46:00
Messages: 6
Offline

When this error happened, we were just using the tomcat default values, while the Terracotta servers had -Xmx512m and -Xms512m.
We recently increased the MaxPermSize to 256 to see if that makes any difference and we are still awaiting the results of that experiment. We are the using hibernate ehcache 4.1.2 snapshot.
sammy_p9

neo

Joined: 07/11/2014 05:31:40
Messages: 1
Offline

Hi,
What was the solution on this. We are facing similar issue.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team