Error setting max JVM heap size based on cgroup limits in Java-based FOLIO docker containers

Description

Java-based docker images using the fabric8-based base images log the following error in their logs:

cat: /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes: No such file or directory
/usr/verticles/container-limits: line 46: [: 9223372036854771712: unary operator expected

Because of this error, containers are unable to properly determine the proper amount of RAM to allocate to the JVM when the container is configured with memory limits at runtime.

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:

John Malconian January 16, 2018 at 9:26 PM

Docker spells out the issue with swap limit support and how to enable it in Debian-based distributions pretty clearly here.
https://docs.docker.com/engine/installation/linux/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities

Our tests systems contain 0 swap. I wonder if enabling swap on these systems is detrimental anyway. If we don't need to swap, we could just use ' /sys/fs/cgroup/memory/memory.limit_in_bytes instead.

John Malconian January 16, 2018 at 9:04 PM

ubuntu@ip-10-36-1-185:/proc/sys/kernel$ sudo docker info
Containers: 20
Running: 20
Paused: 0
Stopped: 0
Images: 20
Server Version: 17.05.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 125
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-1047-aws
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.67GiB
Name: ip-10-36-1-185
ID: TVAK:DYFP:YM2U:I43A:EBNV:TTTP:CPGX:E56N:VYNB:WLIU:Q7RH:RG5C
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

John Malconian January 16, 2018 at 8:54 PM

It appears that /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes does not exist on Debian-based host systems. Will need to investigate other options. Possibly an experimental java option called -XX:+UseCGroupMemoryLimitsforHeap.

Duplicate

Details

Assignee

Reporter

Labels

Priority

Development Team

Core: Platform

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created January 16, 2018 at 8:48 PM
Updated September 6, 2019 at 5:46 PM
Resolved September 6, 2019 at 5:46 PM
TestRail: Cases
TestRail: Runs