Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2596

Found a deadlock when I have mutiple threads running a groovy script

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.5.2
    • 1.5.5
    • None
    • None
    • Patch

    Description

      Found one Java-level deadlock:
      =============================
      "Thread-12":
      waiting to lock monitor 0x0810b934 (object 0xaa61ddb8, a org.codehaus.groovy.reflection.CachedClass),
      which is held by "Thread-11"
      "Thread-11":
      waiting to lock monitor 0x0810b974 (object 0x71b8ce88, a java.util.WeakHashMap),
      which is held by "Thread-12"

      Java stack information for the threads listed above:
      ===================================================
      "Thread-12":
      at org.codehaus.groovy.reflection.CachedClass.getCachedSuperClass(CachedClass.java:131)

      • waiting to lock <0xaa61ddb8> (a org.codehaus.groovy.reflection.CachedClass)
        at org.codehaus.groovy.reflection.CachedClass.<init>(CachedClass.java:125)
        at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:210)
      • locked <0x71b8ce88> (a java.util.WeakHashMap)
        at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:106)
        at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:114)
        at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:102)
        at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:92)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getGlobalMetaClass(MetaClassRegistryImpl.java:247)
      • locked <0x6e29b0c0> (a java.lang.Class)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.access$100(MetaClassRegistryImpl.java:45)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getFromGlobal(MetaClassRegistryImpl.java:112)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getMetaClass(MetaClassRegistryImpl.java:88)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$MyThreadLocal.getMetaClass(MetaClassRegistryImpl.java:356)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:260)
        at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:728)
        at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
        at groovy.lang.Script.<init>(Script.java:40)
        at groovy.lang.Script.<init>(Script.java:37)
        at uc5.<init>(uc5.groovy)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:416)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:584)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:472)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:508)
        at org.terracotta.droid.script.GroovyExec.exec(GroovyExec.java:27)
        at org.terracotta.droid.worker.Worker$1.run(Worker.java:53)
        at java.lang.Thread.run(Thread.java:595)
        "Thread-11":
        at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:165)
      • waiting to lock <0x71b8ce88> (a java.util.WeakHashMap)
        at org.codehaus.groovy.reflection.ParameterTypes.getParametersTypes0(ParameterTypes.java:77)
      • locked <0xaa621940> (a org.codehaus.groovy.reflection.CachedMethod)
        at org.codehaus.groovy.reflection.ParameterTypes.getParameterTypes(ParameterTypes.java:63)
        at org.codehaus.groovy.reflection.CachedMethod.compareToCachedMethod(CachedMethod.java:181)
        at org.codehaus.groovy.reflection.CachedMethod.compareTo(CachedMethod.java:163)
        at java.util.Arrays.mergeSort(Arrays.java:1156)
        at java.util.Arrays.mergeSort(Arrays.java:1168)
        at java.util.Arrays.sort(Arrays.java:1080)
        at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:171)
      • locked <0xaa61ddb8> (a org.codehaus.groovy.reflection.CachedClass)
        at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:268)
        at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:215)
        at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2469)
      • locked <0xaa61d920> (a groovy.lang.MetaClassImpl)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getGlobalMetaClass(MetaClassRegistryImpl.java:248)
      • locked <0x6e293f78> (a java.lang.Class)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.access$100(MetaClassRegistryImpl.java:45)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getFromGlobal(MetaClassRegistryImpl.java:112)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getMetaClass(MetaClassRegistryImpl.java:88)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$MyThreadLocal.getMetaClass(MetaClassRegistryImpl.java:356)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:260)
        at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:728)
        at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
        at groovy.lang.Script.<init>(Script.java:40)
        at groovy.lang.Script.<init>(Script.java:37)
        at uc5.<init>(uc5.groovy)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:416)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:584)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:472)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:508)
        at org.terracotta.droid.script.GroovyExec.exec(GroovyExec.java:27)
        at org.terracotta.droid.worker.Worker$1.run(Worker.java:53)
        at java.lang.Thread.run(Thread.java:595)

      Attachments

        1. groovy-2596-exp1.txt
          7 kB
          James P. White
        2. groovy-2596-exp2.txt
          12 kB
          James P. White
        3. groovy-2596-fix1.txt
          14 kB
          James P. White

        Activity

          People

            jimwhite James P. White
            asi Anatol Sialitski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: