Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-544

createObject method of ObjectFactoryImpl class is not thread safe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • jBPM 3.1.0
    • jBPM 3.1.0
    • Runtime Engine
    • None

      createObject method of ObjectFactoryImpl class is not thread safe

      Code:

      public Object createObject(ObjectInfo objectInfo)

      { clearRegistry(); return getObject(objectInfo); }

      This can cause errors like

      java.lang.RuntimeException: closed JbpmContext more then once... check your try-finally's around JbpmContexts blocks
      at org.jbpm.JbpmContext.popThisContextFromTheStack(JbpmContext.java:493)
      at org.jbpm.JbpmContext.close(JbpmContext.java:139)

      due to bad context creation when calling JbpmConfiguration.createJbpmContext from a lot of different threads

      It's difficult to produce, so try adding a sleep call after clearRegistry() in createObject method, and you will see the problem ...

      I think adding a synchronized will correct the bug.

      Code:

      public synchronized Object createObject(ObjectInfo objectInfo) { clearRegistry(); return getObject(objectInfo); }

      Regards,

      Emmanuel

              tom.baeyens Tom Baeyens (Inactive)
              xeha6284 Emmanuel Hodé (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 5 minutes
                  5m
                  Remaining:
                  Remaining Estimate - 5 minutes
                  5m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified