Error upon jar execution - unable to allocate file descriptor table
Asked Answered
A

4

8

Upon trying to use a jar on the local linux machine, I am getting the following error: library initialization failed - unable to allocate file descriptor table - out of memory

The machine has 32G RAM

I can provide additional information, if needed.

Any help would be appreciated.

Amplify answered 22/3, 2018 at 17:36 Comment(4)
you can try increasing the JVM heap memory size using -Xmx flag when invoking jvm. please refer https://mcmap.net/q/45260/-what-are-the-xms-and-xmx-parameters-when-starting-jvmSchou
I've already tried doing this, unfortunately, it does not help.Amplify
try inspecting the application using jVisualVM. you get a better understanding of how the memory is growing. also you can look at GC activity using a plugin called VisualGC, that will give good understanding of how various memory area in JVM is behavingSchou
I just had the same error. You can try enabling memory overcommiting, by setting /proc/sys/vm/overcommit_memory to 1. That worked for me.Titanium
V
12

In recent versions of Linux default limit for the number of open files has been increased significantly. Java 8 does the wrong thing of trying to allocate memory upfront for this number of file descriptors (see https://bugs.openjdk.java.net/browse/JDK-8150460). Previously this worked, when the default limit was much lower, but now it tries to allocate too much and fails. Workaround for this is to set a lower limit of number of open files (or use newer java):

$ mvn
library initialization failed - unable to allocate file descriptor table - out of memoryAborted
$ ulimit -n 10000
$ mvn
[INFO] Scanning for projects...
...
Vereen answered 5/7, 2019 at 2:21 Comment(1)
worked for me, struggled with that for hours.... simply do smth like echo "ulimit -n 10000 >> /root/.bashrc"Woodwork
K
2

Had this happen to me on some Java applications and curiously all electron-based apps (such as Spotify) after upgrading my Manjaro Linux about a week ago (today is November 19, 2019).

What fixed it was this command (as root, sudo didn't do it:

echo >/etc/security/limits.d/systemd.conf "* hard nofile 1048576"

Then reboot

Hope this helps someone.

Ker answered 19/11, 2019 at 4:47 Comment(0)
J
1

None of the other fixes I found online worked for me, however I noticed that the bug responsible for this defect is in Java 9, and has been resolved since.

I'm on ArchLinux so I notice that when I tried to start the elasticsearch.service in journalctl -xe it showed that for some reason JRE8 was running it, and indeed archlinux-java status showed that Java 8 was the default. Setting to Java 11 fixed the problem for me:

 # archlinux-java set java-11-openjdk
Jamima answered 26/11, 2019 at 19:31 Comment(0)
B
0

I solved this problem by adding these two lines to the /etc/security/limits.conf file:

* soft nofile 4096

* hard nofile 8192

When I was trying to solve this problem on my Kali, I used ulimit -n 10000000 command. But When I tried to run mvn again, it paused and said "unable to allocate file descriptor table" again!

So I turned to modify the /etc/security/limits.conf file.

Berth answered 26/9 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.