Ivy
  1. Ivy
  2. IVY-1362

Memory leak and infinite loop in ModuleId.java

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0-RC2
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Eclipse / IvyDE

      Description

      ModuleId tries save memory by interning objects. This ModuleId cache is not synchronized and when it is mutated from concurrent threads it is possible that the WeakHashMap will contain a loop. As described in the blog post: "A Beautiful Race Condition"

      The same issue and a memory leak was fixed in IVY-791.

      Stacktrace of a hanging thread
      java.lang.Thread.State: RUNNABLE
      	at java.util.WeakHashMap.get(Unknown Source)
      	at org.apache.ivy.core.module.id.ModuleId.intern(ModuleId.java:63)
      	at org.apache.ivy.core.module.id.ModuleId.newInstance(ModuleId.java:48)
      	at org.apache.ivy.core.module.id.ModuleRevisionId.newInstance(ModuleRevisionId.java:100)
      	at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorBuilder.addDependency(PomModuleDescriptorBuilder.java:285)
      	at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:262)
      	at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:108)
      	at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:659)
      	at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
      	at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:676)
      	at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:993)
      	at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:546)
      	at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:266)
      	at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:503)
      	at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
      	at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
      	at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
      	at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:169)
      	at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:287)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:696)
      	at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:781)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:704)
      	at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:769)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:704)
      	at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:769)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:704)
      	at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:781)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:704)
      	at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:781)
      	at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:704)
      	at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:576)
      	at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:237)
      	at org.apache.ivy.Ivy.resolve(Ivy.java:512)
      	at org.apache.ivyde.eclipse.cpcontainer.IvyResolveJobThread.resolve(IvyResolveJobThread.java:224)
      	at org.apache.ivyde.eclipse.cpcontainer.IvyResolveJobThread.run(IvyResolveJobThread.java:127)
      

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Maarten Coene
            Reporter:
            Marcell Hegedus
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development