[SOLVED] LXC Container Problem with MEMLOCK

Sany

New Member
Jun 9, 2023
4
0
1
Hello,

I have a LXC Container with Debian 12.6, i will running a elasticsearch server, but i have a many problems..
my elasticsearch server quits with:

Code:
[2024-07-01T14:19:45,251][INFO ][o.e.n.Node               ] [hen-elastic-01] stopped
[2024-07-01T14:19:45,251][INFO ][o.e.n.Node               ] [hen-elastic-01] closing ...
[2024-07-01T14:19:45,256][INFO ][o.e.n.Node               ] [hen-elastic-01] closed
[2024-07-01T16:42:22,851][WARN ][o.e.b.JNANatives         ] [hen-elastic-01] Unable to lock JVM Memory: error=12, reason=Cannot allocate memory
[2024-07-01T16:42:22,854][WARN ][o.e.b.JNANatives         ] [hen-elastic-01] This can result in part of the JVM being swapped out.
[2024-07-01T16:42:22,854][WARN ][o.e.b.JNANatives         ] [hen-elastic-01] Increase RLIMIT_MEMLOCK, soft limit: 8388608, hard limit: 8388608
[2024-07-01T16:42:22,854][WARN ][o.e.b.JNANatives         ] [hen-elastic-01] These can be adjusted by modifying /etc/security/limits.conf, for example:
        # allow user 'elasticsearch' mlockall
        elasticsearch soft memlock unlimited
        elasticsearch hard memlock unlimited
[2024-07-01T16:42:22,854][WARN ][o.e.b.JNANatives         ] [hen-elastic-01] If you are logged in interactively, you will have to re-login for the new limits to take effect.
[2024-07-01T16:42:22,996][INFO ][o.e.n.Node               ] [hen-elastic-01] version[7.17.22], pid[136], build[default/deb/38e9ca2e81304a821c50862dafab089ca863944b/2024-06-06T07:35:17.876121680Z], OS[Linux/6.8.8-2-pve/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/22.0.1/22.0.1+8-16]
[2024-07-01T16:42:22,997][INFO ][o.e.n.Node               ] [hen-elastic-01] JVM home [/usr/share/elasticsearch/jdk], using bundled JDK [true]
[2024-07-01T16:42:22,997][INFO ][o.e.n.Node               ] [hen-elastic-01] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -Djava.security.manager=allow, -Xms4g, -Xmx4g, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-5087583567018264826, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=/var/lib/elasticsearch, -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:+UnlockDiagnosticVMOptions, -XX:G1NumCollectionsKeepPinned=10000000, -XX:MaxDirectMemorySize=2147483648, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/etc/elasticsearch, -Des.distribution.flavor=default, -Des.distribution.type=deb, -Des.bundled_jdk=true]

so, now i have allready in my /etc/security/limits.conf:
Code:
* soft memlock unlimited
* hard memlock unlimited

elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited

but, i does not work.. i restarted the container without luck.

ulimit -l on the LXC Container:
Code:
ulimit -l
8192

ulimit -l on the PVE:
Code:
ulimit -l
7937336

What's wrong...?

Code:
> prlimit -p 1
RESOURCE   DESCRIPTION                             SOFT      HARD UNITS
AS         address space limit                unlimited unlimited bytes
CORE       max core file size                         0 unlimited bytes
CPU        CPU time                           unlimited unlimited seconds
DATA       max data size                      unlimited unlimited bytes
FSIZE      max file size                      unlimited unlimited bytes
LOCKS      max number of file locks held      unlimited unlimited locks
MEMLOCK    max locked-in-memory address space   8388608   8388608 bytes
MSGQUEUE   max bytes in POSIX mqueues            819200    819200 bytes
NICE       max nice prio allowed to raise             0         0
NOFILE     max number of open files              524288    524288 files
NPROC      max number of processes               247774    247774 processes
RSS        max resident set size              unlimited unlimited bytes
RTPRIO     max real-time priority                     0         0
RTTIME     timeout for real-time tasks        unlimited unlimited microsecs
SIGPENDING max number of pending signals         247774    247774 signals
STACK      max stack size                       8388608 unlimited bytes
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!