1

I have a big problem and that is that my company's production application which I unfortunately can't shutdown and restart ( I am unsure how, and I don't want to do any mistake) is spitting out a lot of exceptions on too many files open when trying to open a socket to read from an ftp server.

2013-01-02 16:19:03,222 ERROR [main] software.background.Program(Program.java:doExecute{225}) - Exception during ftp transfer
someclasses.ftp.FtpException: Could not create connection to xxxx
    at someclasses.communication.ftp.FtpImpl.connect(FtpImpl.java:114)
    at Program.doExecute(Program.java:176)
    at Program.main(Program.java:287)
Caused by: java.net.SocketException: Too many open files
    at java.net.Socket.createImpl(Socket.java:397)
    at java.net.Socket.<init>(Socket.java:371)
    at java.net.Socket.<init>(Socket.java:189)
    at someclasses.Ftp.connect(Ftp.java:386)

I understand that the per application limit of open files / sockets and so on is reached. Is there any way to increase this maximum for the time being without closing the application? I have run the command ulimit and it states unlimited. I've tried to check how many connections it has open with the lsof -p PID command but it states "command not found".

Would be very glad if someone could help me find another similar effect that lsof has (I think it's a red hat machine) and advice for how to fix this temporary? The most pleasant solution to this would be to increase the files / sockets the application could open. This is just a plain java application.

Thanks in advance!

EDIT another solution would be if there were any command where I could look up how this program was run from the beginning with all the eventual flags. Then I maybe could restart it with success. This is a legacy app.

7
  • to look up the full command lines for running apps use "ps -FA" Jan 2, 2013 at 15:55
  • Thanks for the comment, I will probably use this if changing the ulimit -n to 2048 instead of 1024 won't fix it. lj4newbies.blogspot.se/2007/04/too-many-open-files.html changed it to the nofile configuration displayed in the link. You think it'll work?
    – cubsink
    Jan 2, 2013 at 16:03
  • 1
    Running out of file descriptor also could be hint that your app is leaking file descriptors: missing to close them if not used anymore. If this is the case, increasing the number of available file descriptors won't help in the long.
    – alk
    Jan 2, 2013 at 16:11
  • can you check /proc/sys/fs/file-max
    – JoG
    Jan 2, 2013 at 16:27
  • @JoG That is a system maximum. Jan 2, 2013 at 16:29

1 Answer 1

1

It all ended with a restart of the application. I changed the ulimit -n to 2048 and reloaded the config. However, all processes inherited the old config and the application had to be restarted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .