question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java processes don't use flags for correct heap sizing within docker

See original GitHub issue

See https://blog.csanchez.org/2017/05/31/running-a-jvm-in-a-container-without-getting-killed/.

The -XX:+UseCGroupMemoryLimitForHeap flag seems to be enabled by default on newer versions of openjdk:8:

docker run --rm -m 100MB openjdk:8u212 java -XshowSettings:vm -version

but the public base-java still uses an older one that would need the manual flag:

docker run --rm -m 100MB jitsi/base-java java -XshowSettings:vm -version

This can cause unexpected out of memory / crashes.

The container support has been further improved in JDK 10:

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bkempecommented, Jun 29, 2019

BTW, this is a helpful tool for setting the JVM memory sizes correctly within docker: https://github.com/cloudfoundry/java-buildpack-memory-calculator https://github.com/meisterplan/jdk-base is a docker image that also uses these calculations

1reaction
damenchocommented, May 7, 2019

Jigasi is setting JIGASI_MAX_MEMORY=3072m. And by the way, I’ve tested java11 and I’m currently pushing PRs so we can run using java11. Trying to push it these days, release on meet.jit.si and push it to stable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Configure Java Heap Size Inside a Docker Container
In this tutorial, we'll see how to set JVM parameters in a container that runs a Java process. Although the following applies to...
Read more >
Java inside docker: What you must know to not FAIL
You can see it in action on the following Dockerfile. The JVM read that the container is limited to 600M and created a...
Read more >
Java using much more memory than heap size (or size ...
The heap size is set to 128 MB ( -Xmx128m -Xms128m ) while the container takes up to 1GB of memory. Under normal...
Read more >
Best Practices: Java Memory Arguments for Containers - DZone
When running your Java application in physical servers, you would have been using '-Xmx' JVM argument to specify the Java heap size.
Read more >
How to reduce your JVM app memory footprint in Docker and ...
Container overall used memory with different heap flags ... size means the app will not handle bursts well — so this does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found