Created attachment 216466 [details] increase memory 256 (default) -> 512 MB (svn diff) Aarch64 has OpenJDK8 without hotspot compiler. I'm not sure if that is the reason it goes OutOfMemory in the build step. See http://thunderx1.nyi.freebsd.org/data/121arm64-quarterly/540450/logs/errors/cassandra3-3.11.6.log build-test: [javac] Compiling 606 source files to /wrkdirs/usr/ports/databases/cassandra3/work/apache-cassandra-3.11.6-src/build/test/classes [javac] [javac] [javac] The system is out of resources. [javac] Consult the following stack trace for details. [javac] java.lang.OutOfMemoryError: Java heap space [javac] at com.sun.tools.javac.code.Scope$ImportScope.makeEntry(Scope.java:530) [javac] at com.sun.tools.javac.code.Scope.enter(Scope.java:220)
Looks Ok to me if the default is indeed 256 MB, though I can't find where this would be getting set on my (amd64) machine either in Mk/, /usr/local/bin/ant, nor in the ant manual.
Maybe it would be better to have ANT_OPTS="$ANT_OPTS -Xmx512M" in case someone already has some settings in ANT_OPTS.
(In reply to Angelo Polo from comment #1) Ah, I looked it up. The default of openjdk 8 is like 1/4 of the amount of memory depending on some conditions like client or server VM. My RPI3 has 1GB mem. I don't know how much mem the pkg build system has. I think properly defining the max. gives more predictable results anyways. I will look into keeping existing ANT_OPTS values and update the patch.
Created attachment 216511 [details] set max mem to 512 MB (svn diff) Used the ANT_OPTS="$ANT_OPTS ..." construction. Did some more testing with "java -XX:+PrintFlagsFinal -version | grep MaxHeap". On my RPI3 with 1 GB RAM Java uses a default mx of 256MB which is too small. On my amd64 VM with 5 GB RAM Java uses an mx of 1270MB which is plenty. Both compile perfectly with -Xmx512m. jstat -gc shows the RPI3 does quite some GC and reaches 512MB quite often. The amd64 never hits the max mem with 512 MB avail. This is all on openjdk8. RPI3: OpenJDK 64-Bit Zero VM (build 25.242-b07, interpreted mode) AMD64: OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode) So I think this is ready to be committed.
Is it required with jdk11? (jdk8 is in zero mode, jdk11 is in mixed mode on aarch64)
(In reply to Mikael Urankar from comment #5) My quick test with OpenJDK 11 gives build errors. [javac] /data/ports-build/usr/ports/databases/cassandra3/work/apache-cassandra-3.11.6-src/src/java/org/apache/cassandra/utils/Throwables.java:80: err or: unreported exception Exception; must be caught or declared to be thrown [javac] perform(Stream.of(actions)); ... [javac] /data/ports-build/usr/ports/databases/cassandra3/work/apache-cassandra-3.11.6-src/src/java/org/apache/cassandra/utils/concurrent/Locks.java:46: error: cannot find symbol [javac] unsafe.monitorEnter(object); [javac] ^ [javac] symbol: method monitorEnter(Object) [javac] location: variable unsafe of type Unsafe [javac] /data/ports-build/usr/ports/databases/cassandra3/work/apache-cassandra-3.11.6-src/src/java/org/apache/cassandra/utils/concurrent/Locks.java:52: error: cannot find symbol [javac] unsafe.monitorExit(object); [javac] ^ [javac] symbol: method monitorExit(Object) [javac] location: variable unsafe of type Unsafe Unfortunately I don't have the time to dive into the specific code.
(In reply to Mikael Urankar from comment #5) databases/cassandra3 isn't compatible with Java 11, so let's not worry about that. Too bad we can't very easily specify a minimum max memory (letting Java set a higher max from the default but not allowing it to set a limit below a certain value). But wishful thinking aside, this gets a green light from me.
A commit references this bug: Author: mikael Date: Fri Jul 24 15:47:22 UTC 2020 New revision: 543250 URL: https://svnweb.freebsd.org/changeset/ports/543250 Log: databases/cassandra3: fix build on aarch64 (Java OutOfMemory during build) increase memory 256 (default) to 512 MB PR: 247997 Submitted by: Ronald Klop <ronald-lists@klop.ws> Approved by: Angelo Polo <language.devel@gmail.com> (maintainer) Changes: head/databases/cassandra3/Makefile
Committed, Thanks!