jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JCR-3013) ArrayIndexOutOfBoundsException: ConcurrentCache
Date Tue, 09 Aug 2011 17:07:27 GMT

     [ https://issues.apache.org/jira/browse/JCR-3013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jukka Zitting updated JCR-3013:
-------------------------------

    Fix Version/s:     (was: 2.3.0)
                   2.2.8

There was still a slight chance of this problem occurring in the case that one thread was
accessing an overflown access count with getAccessCount() right before the recordCacheAccess()
method would have reset the counter. I fixed that in revision 1155431 by using Math.abs()
in ConcurrentCache.shrinkIfNeeded(). I also switched the counter to an AtomicLong just to
reduce the chance of other overflow issues popping up in the CacheManager class that also
uses access counts. The long value would take about 300 years to overflow even if the cache
was accessed once every nanosecond...

I merged this and the earlier change to the 2.2 branch in revision 1155435 for inclusion in
Jackrabbit 2.2.8.

> ArrayIndexOutOfBoundsException: ConcurrentCache
> -----------------------------------------------
>
>                 Key: JCR-3013
>                 URL: https://issues.apache.org/jira/browse/JCR-3013
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.2.5, 2.2.7
>         Environment: My Platform:
> - Linux Debian (64)
> - sun
>   java version "1.6.0_22"
>   Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
>   Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
> - MemTotal:     49563216 kB     
> - Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
> - apache sling / JCR Cluster
>            Reporter: Michael Klenk
>             Fix For: 2.2.8
>
>         Attachments: ConcurrentCache.patch
>
>
> ArrayIndexOutOfBoundsException after several days of uptime.
> I'm experiencing some strange ArrayIndexOutOfBoundsExceptions on
>  accessing the jackrabbit ConcurrentCache in 2.2.5. in Line 241 during
>  shrinkIfNeeded check.
>  Caused by: java.lang.ArrayIndexOutOfBoundsException: -14
>         at
>  org.apache.jackrabbit.core.cache.ConcurrentCache.shrinkIfNeeded(ConcurrentCache.java:241)
> I reviewed jackrabbit-code and I'm sure it's caused by that
>  AtomicInteger for realizing accessCounter in AbstractCache, which will
>  have become negative during increasing over the Integer.MAX_VALUE constant.
>          // Semi-random start index to prevent bias against the first
>  segments
>          int start = (int) getAccessCount() % segments.length;
>          for (int i = start; isTooBig(); i = (i + 1) % segments.length) {
>              synchronized (segments[i]) {
>  ___________________________
>  Uncaught Throwable java.lang.ArrayIndexOutOfBoundsException: -7
>          at
>  org.apache.jackrabbit.core.cache.ConcurrentCache.shrinkIfNeeded(ConcurrentCache.java:241)
>          at
>  org.apache.jackrabbit.core.cache.ConcurrentCache.put(ConcurrentCache.java:176)
>          at
>  org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.getBundle(AbstractBundlePersistenceManager.java:657)
>          at
>  org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.load(AbstractBundlePersistenceManager.java:400)
>          at
>  org.apache.jackrabbit.core.state.SharedItemStateManager.loadItemState(SharedItemStateManager.java:1819)
>          at
>  org.apache.jackrabbit.core.state.SharedItemStateManager.getNonVirtualItemState(SharedItemStateManager.java:1739)
>          at
>  org.apache.jackrabbit.core.state.SharedItemStateManager.getItemState(SharedItemStateManager.java:261)
>          at
>  org.apache.jackrabbit.core.state.LocalItemStateManager.getNodeState(LocalItemStateManager.java:107)
>          at
>  org.apache.jackrabbit.core.state.LocalItemStateManager.getItemState(LocalItemStateManager.java:172)
>          at
>  org.apache.jackrabbit.core.state.XAItemStateManager.getItemState(XAItemStateManager.java:260)
>          at
>  org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:161)
>          at
>  org.apache.jackrabbit.core.ItemManager.getItemData(ItemManager.java:370)
>          at
>  org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:316)
>          at
>  org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:610)
>          at
>  org.apache.jackrabbit.core.SessionImpl.getNodeById(SessionImpl.java:493)
>          at
>  org.apache.jackrabbit.core.SessionImpl.getNodeByIdentifier(SessionImpl.java:1045)
>          at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
>          at
>  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:597)
>          at
>  org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:109)
>          at $Proxy2.getNodeByIdentifier(Unknown Source)
>          at
>  de.dig.cms.frontend.servlet.helper.ResourceUtil.findResourceById(ResourceUtil.java:44)
>          at
>  de.dig.cms.frontend.servlet.CMSContentEnrichServletFilter.doFilter(CMSContentEnrichServletFilter.java:194)
>          at
>  org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
>          at
>  de.dig.cms.frontend.servlet.CacheControlFilter.doFilter(CacheControlFilter.java:120)
>          at
>  org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
>          at
>  de.dig.cms.cache.impl.WallCacheServletFilter.processCacheableRequest(WallCacheServletFilter.java:244)
>          at
>  de.dig.cms.cache.impl.WallCacheServletFilter.processCacheableRequestWithLatch(WallCacheServletFilter.java:185)
>          at
>  de.dig.cms.cache.impl.WallCacheServletFilter.doFilter(WallCacheServletFilter.java:154)
>          at
>  org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
>          at
>  de.dig.cms.frontend.servletapi.CMSSlingHttpServletRequestFilter.doFilter(CMSSlingHttpServletRequestFilter.java:52)
>          at
>  org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
>          at
>  org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:313)
>          at
>  org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:207)
>          at
>  org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>          at
>  org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
>          at
>  org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
>          at
>  org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>          at
>  org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>          at
>  org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
>          at
>  org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
>          at
>  org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>          at org.mortbay.jetty.Server.handle(Server.java:324)
>          at
>  org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
>          at
>  org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
>          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
>          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>          at
>  org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>          at
>  org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message