Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5800

ProjectClassLoader leak in executable model compilation of declare types

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 7.45.0.Final
    • core engine
    • None
    • 2020 Week 46-48 (from Nov 9)
    • Hide

      Running:

          mvn clean test -Dtest=KjarBuildWithLeakTest
      

      will produce a OutOfMemoryError.

      Running instead:

          mvn clean test -Dtest=KjarBuildWithoutLeakTest
      

      will not produce any error, because a clear of the static maps if forced after every compilation.

      Show
      Running: mvn clean test -Dtest=KjarBuildWithLeakTest will produce a OutOfMemoryError . Running instead: mvn clean test -Dtest=KjarBuildWithoutLeakTest will not produce any error, because a clear of the static maps if forced after every compilation.
    • Undefined
    • NEW
    • NEW
    • ---
    • ---

    Description

      When compiling a DRL containing declare types with executable model, the ProjectClassLoader associated with the compiled declare types is kept in scope by a couple of static maps:

          org.drools.model.bitmask.BitMaskUtil.accessiblePropertiesCache;
          org.drools.modelcompiler.util.ClassUtil.ACCESSIBLE_PROPS_CACHE;
      

      In turn, this generates a leak of all the resources associated with the ProjectClassLoader (e.g., MemoryFileSystem with all the source content of the kmodule).

      We also have a concern on the thread safety of these static maps (as they do not appear to be synchronized). I.e., what happens if multiple kmodules are compiled concurrently by different threads?

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mcasalino Matteo Casalino (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: