Maven "Java heap space" error with Sakai 23 + Java 11

179 views
Skip to first unread message

Austin

unread,
Oct 8, 2021, 4:22:10 PM10/8/21
to sakai-dev
Hello Sakai Devs,

Is anyone else seeing intermittent java heap space issues when compiling Sakai 23 + Java 11?
I'm using:

Java 11 (Temurin  "11.0.12" 2021-07-20)
Maven 3.8.2

[ERROR] Failed to execute goal org.sakaiproject.maven.plugins:sakai:1.4.5:component (default-component) on project sakai-kernel-impl: Error assembling WAR: Problem creating war: Execution exception: Java heap space -> [Help 1]

I don't recall seeing this issue with Sakai 22 + Java 8, but increasing -Xmx to 2048 seems to be helping so far.

export MAVEN_OPTS="-Xms512m -Xmx2048m"

Anyway, if anyone else is seeing this error and increasing xmx helps you too, perhaps this doc should be updated:


and could some Sakai 22 and Sakai 23 docs with that info could be added to install guides under:


Thanks,

Austin

Austin

unread,
Oct 8, 2021, 5:08:18 PM10/8/21
to sakai-dev
Also, I'm running mvn with 

-T 1C

to enable multi core building and I think that also takes up extra memory.

Matthew Jones

unread,
Oct 8, 2021, 5:15:55 PM10/8/21
to Austin, sakai-dev
I haven't seen that yet locally, but I did notice and wrote on Slack that Java brought a number of new options for memory allocation that we may want to make better recommendations for. This article had a good summary. https://www.atamanroman.dev/articles/jvm-memory-settings-container-environment/

You can pretty much remove the other memory options now and use things like
-XX:MaxRAM=3g and -XX:MaxRAMFraction=1 to let it use up to 3gb.

They also have this -XX:MaxRAMPercentage to allow a process to use a percentage of what's available. It also looks like Java can better detect when it's running in a container and adjust it's RAM usage in that case too. 

For Maven I usually don't set any memory options at all, but I also run my builds in a Docker container. My only opts are
MAVEN_OPTS=-XX:+TieredCompilation -XX:TieredStopAtLevel=1

I also use the -T C1

--
You received this message because you are subscribed to the Google Groups "Sakai Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sakai-dev+...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/sakai-dev/CAKL84%3DkagzWD3fxW4rNqM5H82SwK%3DVYZbE7%3DEXiiUTCJ0SJc6w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages