I have a java application deployed on tomcat 7 running on ubuntu 10.04. While opening the server socket, there was a problem that I could not reproduce so far:
java.net.SocketException: Cannot allocate memory at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(Unknown Source) at java.net.ServerSocket.bind(Unknown Source) at org.subethamail.smtp.server.SMTPServer.createServerSocket(SMTPServer.java:338) at org.subethamail.smtp.server.SMTPServer.start(SMTPServer.java:291)
All I was able to figure out is that this happens in some specific version of MacOS that doesn't matter to me, and also in OpenJDK that doesn't matter either (I'm using Oracle JRE 1.7.0_17). Another the possible reason is the virtualization environment, but in my case it happens in the hardware window.
So the question is, has anyone ever encountered the same problem and what might be a possible solution.
Update There was this thing: tomcat consumed almost the entire heap, approximately 700 mb, it was caused by a memory leak in my code. But, as I understand it, the exception speaks of a socket buffer at the system level, so it seems to be unconnected with a bunch of java. However, this is the only explanation that I have received so far, and it is very illusory, in my opinion.
Update 2 In the end, we were able to reproduce the problem several times, so it was not a memory leak. I considered authbind as a possible source of the problem when I first encountered it, but, unfortunately, I did not pay much attention to this. When I had another hardware kernel affected by this problem, I tried to bind an untethered port and succeeded, while trying to bind privileged ports threw exceptions. So in the end I replaced authbind iptables.
Basically, fady taher answers with authbind points, but Danny Thomas's answer gives very interesting information about the connections between the forward and "Unable to allocate memory", in fact we also use the process builder to run bash scripts, so there is a high probability that the problem may be caused by him.
java tomcat ubuntu
Ruslan Sverchkov
source share