Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-4402

Maven build is extremely memory demanding with JDK11

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • jbossws-cxf-7.0.0.Final
    • jbossws-cxf
    • None
    • Workaround Exists
    • Hide

      Downgrade the plugin version with adding this to commandline:
      -Dversion.resources.plugin=3.1.0

      Show
      Downgrade the plugin version with adding this to commandline: -Dversion.resources.plugin=3.1.0

      We noticed an anomaly when the project build is executed with JDK11, starting with version JBWS 7.0.0 - it was eating all available memory on 4GB node (amount that previously was good enough and is still working fine when executing with JDK17) leading to system killing the maven build during the testsuite, eg.:

      12:18:41 # There is insufficient memory for the Java Runtime Environment to continue.
      12:18:41 # Native memory allocation (mmap) failed to map 268435456 bytes for committing reserved memory.
      

      After some investigation and debugging the problem was isolated to invocation of maven-resources-plugin:

      18:06:19 top - 17:06:19 up 8 min,  0 users,  load average: 1.63, 1.08, 0.52
      18:06:19 Tasks:   2 total,   0 running,   2 sleeping,   0 stopped,   0 zombie
      18:06:19 %Cpu(s): 96.7 us,  0.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  3.3 hi,  0.0 si,  0.0 st
      18:06:19 MiB Mem :   3645.9 total,    221.4 free,   1110.4 used,   2576.3 buff/cache
      18:06:19 MiB Swap:      0.0 total,      0.0 free,      0.0 used.   2535.5 avail Mem 
      18:06:19 
      18:06:19     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
      18:06:19    5047 hudson    20   0 3550808 365104  32820 S 200.0   9.8   0:19.55 /opt/x86_64/openjdk11_last/bin/java -DdownloadSources=true -classpath /opt/apache-maven-3.9.0/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/opt/apache-maven-3.9.0/bin/m2.conf -Dmaven.home=/opt/apache-maven-3.9.+
      
      18:06:19 [INFO] --- resources:3.2.0:testResources (default-testResources) @ jbossws-cxf-specific-tests ---
      18:06:19 [INFO] Using 'UTF-8' encoding to copy filtered resources.
      18:06:19 [INFO] Using 'UTF-8' encoding to copy filtered properties files.
      18:06:19 [INFO] Copying 7 resources
      18:06:19 [INFO] Copying 8 resources
      18:06:19 [INFO] Copying 0 resource to ../test-classes
      18:06:19 [INFO] Copying 184 resources to ../test-resources
      18:06:19 [INFO] Copying 75 resources to ../test-resources
      18:06:19 [INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
      18:06:19 [INFO] Using 'UTF-8' encoding to copy filtered resources.
      18:06:19 [INFO] Copying 7 resources
      18:06:19 [INFO] Copying 184 resources to ../test-resources
      
      18:06:20 top - 17:06:20 up 8 min,  0 users,  load average: 1.63, 1.08, 0.52
      18:06:20 Tasks:   2 total,   0 running,   2 sleeping,   0 stopped,   0 zombie
      18:06:20 %Cpu(s): 86.7 us, 10.0 sy,  0.0 ni,  3.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
      18:06:20 MiB Mem :   3645.9 total,    134.1 free,   1539.5 used,   2234.8 buff/cache
      18:06:20 MiB Swap:      0.0 total,      0.0 free,      0.0 used.   2106.4 avail Mem 
      18:06:20 
      18:06:20     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
      18:06:20    5047 hudson    20   0 3553880 819896  32820 S 193.3  22.0   0:21.78 /opt/x86_64/openjdk11_last/bin/java -DdownloadSources=true -classpath /opt/apache-maven-3.9.0/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/opt/apache-maven-3.9.0/bin/m2.conf -Dmaven.home=/opt/apache-maven-3.9.+
      
      18:06:21 top - 17:06:21 up 8 min,  0 users,  load average: 1.66, 1.09, 0.53
      18:06:21 Tasks:   2 total,   0 running,   2 sleeping,   0 stopped,   0 zombie
      18:06:21 %Cpu(s): 93.3 us,  0.0 sy,  0.0 ni,  6.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
      18:06:21 MiB Mem :   3645.9 total,    112.5 free,   1848.5 used,   1947.4 buff/cache
      18:06:21 MiB Swap:      0.0 total,      0.0 free,      0.0 used.   1797.4 avail Mem 
      18:06:21 
      18:06:21     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
      18:06:21    5047 hudson    20   0 3553880   1.1g  32820 S 193.3  30.4   0:23.97 /opt/x86_64/openjdk11_last/bin/java -DdownloadSources=true -classpath /opt/apache-maven-3.9.0/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/opt/apache-maven-3.9.0/bin/m2.conf -Dmaven.home=/opt/apache-maven-3.9.+
      

      Here we can see that after the resources plugin invocation the memory used by maven itself rises from 365MB to 1.1GB. We can see in attached chart 6.2.0_7.0.0.svg this memory level never gets down again and thus eating about ~600MB more that is then missing for tests.

      Now it gets interesting because JBossWS project is using custom filtering addition to the resources plugin https://github.com/jbossws/jbossws-cxf/blob/main/modules/testsuite/pom.xml#L201-L217

      Going back to https://github.com/jbossws/jbossws-cxf/compare/jbossws-cxf-6.2.0.Final...jbossws-cxf-7.0.0.Final one of the biggest move was jbossws-parent upgrade which among others changed version of maven-resources-plugin from 3.1.0 to 3.2.0.

      And indeed running the project with `-Dversion.resources.plugin=3.1.0` fixes the memory problem.

      So we have two options here:
      1) downgrade the plugin to 3.1.0 (but that version is really old and there already is 3.3.1 out there https://github.com/apache/maven-resources-plugin/tags)
      2) update https://github.com/jbossws/resource-filter-maven-plugin project (last update 6 years ago) to be better compatible with recent resources plugin versions.

      Option 2 is more work but obviously is a better fix.

            rhn-engineering-ema Jim Ma
            jbliznak@redhat.com Jan Blizňák
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: