Package: openjdk-17-jre-headless Version: 17.0.6+10-1~deb11u1 Severity: important Tags: upstream
Dear Maintainer, On a certain multi-user system, I have the following lines in /etc/profile ... ulimit -d 999999 ulimit -v 3899999 In other words, almost 4G virtual memory per process, of which 1G data segment. (Physical RAM is currently 16G.) But with those settings, and the Java runtime default memory alocation, Java does not start. Even "java -help" or "java -version" fails with a memory error! $ java -version Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes Now, I can pass an argument to limit Java heap size, and it works: $ java -Xmx1500m -version openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Debian-1deb11u1) OpenJDK 64-Bit Server VM (build 17.0.6+10-Debian-1deb11u1, mixed mode, sharing) But there's a point where it gets weird: $ java -Xmx1750m -version openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Debian-1deb11u1) OpenJDK 64-Bit Server VM (build 17.0.6+10-Debian-1deb11u1, mixed mode, sharing) $ java -Xmx1800m -version [0.019s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached. Error occurred during initialization of VM $ java -Xmx1900m -version Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes Or if I adjust the "ulimit -v" limit downward, the safe-start point of the Java VM goes down, but not one-for-one... $ ulimit -v 3699999 $ java -Xmx1750m -version Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes $ java -Xmx1650m -version openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Debian-1deb11u1) OpenJDK 64-Bit Server VM (build 17.0.6+10-Debian-1deb11u1, mixed mode, sharing) Upstream bug https://bugs.openjdk.org/browse/JDK-8071445 . Last comment: > This is not critical for JDK 7. As the filer stated, there is an obvious > workaround to lower the maximum heap size. However, when we decide the > default maximum heap, it would be good to look at the ulimit and set a lower > maximum heap size if that limit is set. But the "obvious workaround" is not always straightforward when using applications or tools built on Java (e.g., Eclipse or Gradle). The JDK already checks whether it's in a Docker container and adjusts its memory allocation strategy accordingly, see https://www.oracle.com/java/technologies/javase/8u191-relnotes.html#JDK-8146115 . If no memory-tuning arguents are passed in and "ulimit -v" is in effect (getrlimit(RLIMIT_AS, ...) ), the JDK should find a memory structure that fits within the available memory, or give a friendlier error-message if it can't. (If -Xms and -Xmx both set, and the initial allocation would succeed but the maximum allocation would fail, maybe Java should print a warning.) -- System Information: Debian Release: 11.7 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldoldstable'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-15-amd64 (SMP w/4 CPU threads) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages openjdk-17-jre-headless depends on: ii ca-certificates-java 20190909 ii java-common 0.72 ii libasound2 1.2.4-1.1 ii libc6 2.31-13+deb11u6 ii libcups2 2.3.3op2-3+deb11u2 ii libfontconfig1 2.13.1-4.2 ii libfreetype6 2.10.4+dfsg-1+deb11u1 ii libgcc-s1 10.2.1-6 ii libharfbuzz0b 2.7.4-1 ii libjpeg62-turbo 1:2.0.6-4 ii liblcms2-2 2.12~rc1-2 ii libnss3 2:3.61-1+deb11u3 ii libpcsclite1 1.9.1-1 ii libstdc++6 10.2.1-6 ii util-linux 2.36.1-8+deb11u1 ii zlib1g 1:1.2.11.dfsg-2+deb11u2 openjdk-17-jre-headless recommends no packages. Versions of packages openjdk-17-jre-headless suggests: ii fonts-dejavu-extra 2.37-2 pn fonts-indic <none> ii fonts-ipafont-gothic 00303-21 ii fonts-ipafont-mincho 00303-21 ii fonts-wqy-microhei 0.2.0-beta-3.1 ii fonts-wqy-zenhei 0.9.45-8 ii libnss-mdns 0.14.1-2 -- no debconf information