Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2740

Memory leak with PlanningPin and groupBy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.24.0.Final
    • 8.14.0.Final, 8.21.0.Final, 8.22.0.Final
    • optaplanner-core
    • None
    • 2022 Week 23-25 (from Jun 6)
    • 2
    • Hide

      I've created a sample maven project which reproduces the issue.

      Extract the planner-leak.zip file, cd into the extracted 'planner-leak' folder.

      Run 

      mvn clean install

      Then run 

      java -Xmx1g -verbose:gc -jar target/planner-leak-1.0-SNAPSHOT.jar

      The project will start running, and if you include the -verbose:gc flag, it should quickly show increasing memory usage (over 200Mb in 4 seconds)

      Eventually it will get to 1Gb and run out of memory.

      The problem goes away if the 'pinned' variable is set to false in 'Entity.java', or we filter out all pinned entities in ConstraintProviderImpl.

       

      Below output from my system (java version and maven version that i'm running)

      $ mvn -version
      Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
      Maven home: /opt/maven
      Java version: 11.0.15, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-11-jdk-amd64
      Default locale: en_GB, platform encoding: UTF-8
      OS name: "linux", version: "5.13.0-44-generic", arch: "amd64", family: "unix"
      
      Show
      I've created a sample maven project which reproduces the issue. Extract the planner-leak.zip file, cd into the extracted 'planner-leak' folder. Run  mvn clean install Then run  java -Xmx1g -verbose:gc -jar target/planner-leak-1.0-SNAPSHOT.jar The project will start running, and if you include the -verbose:gc flag, it should quickly show increasing memory usage (over 200Mb in 4 seconds) Eventually it will get to 1Gb and run out of memory. The problem goes away if the 'pinned' variable is set to false in 'Entity.java', or we filter out all pinned entities in ConstraintProviderImpl.   Below output from my system (java version and maven version that i'm running) $ mvn -version Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /opt/maven Java version: 11.0.15, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-11-jdk-amd64 Default locale: en_GB, platform encoding: UTF-8 OS name: "linux" , version: "5.13.0-44- generic " , arch: "amd64" , family: "unix"
    • NEW
    • NEW

      When a planningEntity with a 'true' @PlanningPin property gets processed in a constraintStream groupBy function, Optaplanner goes out of memory very quickly.

      The memory leak goes away when we apply a filter before the groupBy which filters out any 'pinned' entities, however I don't think this is correct behaviour.

      Optaplanner 7.44.0.Final does not have this issue.

              lpetrovi@redhat.com Lukáš Petrovický (Inactive)
              maketimelad Tim Alkemade (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: