Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since some days, we're getting "Too Many Open Files" within an Java application while loading files. So i start searching on Google, and increased fs.file-max to 200000 in my /etc/sysctl.conf. After this, i run sysctl -p. But, this not helped. Because when i type cat /proc/sys/fs/file-nr, it returns 2550 0 200000. The first four digits vary, but the 0 is always 0, since i started looking..

What i'm doing wrong over here, or how can i fix this?

I'm running CentOS release 5.9 (final), with one SSD, so i don't think that would be the problem. (Also, he is not fill, weak or anything and he run fine for months now.)

Another thing, but i'm not sure if it has anything with the issue; i'm able to create, destroy and edit files through SSH with nano/rm. And the Java application runs fine before this issue.


share|improve this question

closed as off-topic by EEAA, Ward, mdpc, Falcon Momot, Bryan Jul 29 '13 at 8:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Falcon Momot, Bryan
If this question can be reworded to fit the rules in the help center, please edit the question.

How precisely is your application being launched? – David Schwartz Jul 29 '13 at 1:39
It's an Minecraft server (Java game). Launched with /usr/bin/java -Xmx30720M -Xms30720M -jar (url) nogui. – Wouter0100 Jul 29 '13 at 1:59
Okay, so you manually launched it from the command line? If so, from what shell? And did you issue a ulimit -n command first? – David Schwartz Jul 29 '13 at 5:58
up vote 0 down vote accepted

Forget the OS level fs.file-max, it's the maximum number of file handles your current user/group is allowed to have (per process) you want to edit. See ulimit -n.

You may adjust this limit as root by modifying /etc/security/limits.conf. Also make sure the limit is applied by adding ulimit -SHn 8192 (or whatever limit you wish to have) to your ~/.bashrc.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.