Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3675

java.lang.LinkageError, but only sometimes (multithreading issue)

    XMLWordPrintable

Details

    Description

      See mail on mailinglist:

      We have an application (A) deployed on JBoss 7.1.1 accepting commands (CQRS,
      but only C and Q :) ). A console application (B) is sending a large volume
      of commands to create entities in A. Entities in A are validated by Drools
      (plain drl files, configured in spring using drools-spring). Most of the
      time this works just fine. But sometimes, we get the following exception:
      
      java.lang.LinkageError: loader (instance of
      org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted
      duplicate class definition for name:
      "a/b/c/Rule_person_unique___name_656ee3db19d34e689d95e2d6b2be67b6"
              at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]
              at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30]
              at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_30]
              at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(JavaDialectRuntimeData.java:615) [drools-core-5.4.0.Final.jar:5.4.0.Final]
              at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:254) [knowledge-api-5.4.0.Final.jar:5.4.0.Final]
              at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237) [knowledge-api-5.4.0.Final.jar:5.4.0.Final]
              at org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88) [knowledge-api-5.4.0.Final.jar:5.4.0.Final]
              at java.lang.ClassLoader.loadClass(ClassLoader.java:295) [rt.jar:1.6.0_30]
              at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [rt.jar:1.6.0_30]
              at a.b.c.Rule_person___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0InvokerGenerated.evaluate(Unknown Source)
              at a.b.c.Rule_person___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0Invoker.evaluate(Unknown Source)
              at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114) [drools-core-5.4.0.Final.jar:5.4.0.Final]
      
      Any idea where this is coming from or what's causing this. 
      

      And the answer:

      I have never experienced this myself, but after having a quick look at the code I believe this could be a multi-threading problem.
      In the abstract class java.lang.ClassLoader the method loadClass(String, boolean) is synchronized, but both org.drools.util.CompositeClassLoader
      and org.drools.rule.JavaDialectRuntimeData$PackageClassLoader override this method without the use of "synchronized".
      
      I would suggest you create a JIRA issue for this.
      

      We are now trying 5.5.0.CR1 and so far, we have not encountered this issue. I'll keep you posted should the same issue appear on 5.5.0.CR1

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            kennywest kenneth westelinck (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: