Too Many Files Open!

Discussion in 'Performance Tweaking' started by SpaZMonKeY777, Jan 23, 2013.

  1. SpaZMonKeY777

    Wiki Team

    So a few weeks ago I ran into a problem with my server where my console would start getting spammed with this error, and I would have to shut it down and restart. Sometimes it would boot it perfectly fine, other times it would start the spam right after it's back online. I run my server on CentOS5 and I did some research to fix the issue, and came across a handful of different commands to increase file size limits.

    Non seemed to work except for this line: 'ulimit -n' which showed 1024, so I changed it to a larger value and voila, no more problems. The only issue I am running into now is that value is not hard set, meaning it reverts back to 1024 once a day.

    So my question is, for those who have to deal with this, what kind of settings do you use? Is this a common problem? Or could this be a problem with a plugin not closing files properly?
     
  2. Jigsaw

    Supporter

    I only had this issue one time. It was on Spigot #430 (not that I'm implying it was Spigot's fault) and the error was preceded by "Failed to check session lock, aborting". After that error spammed quite a few times I was then spammed with "Too many files open" and my server shut itself down. I was able to restart and a few players inventories were reset (I assume their files were open and couldn't be saved), but not everyone was affected.

    I'm not exactly sure how to fix this or prevent it. I found this page helpful on at least seeing how many files were open at a given time. You can also display all of the open files as noted on that page. It could be a plugin or Sptigot itself.
     
  3. What plugins are you using? I'd highly recommend seeing if any of them have database capabilities. I used to run into this issue all the time until I moved my Towny database from flatfile to MYSQL.
     
  4. I've had this problem on two occasions, if you are running a block log plugin or McMMO then I could almost promise this is the cause of your problem. To fix it I recommend first that you make sure the plugins are running of a MySQL server, if that fails I would recommend trying to downgrade/upgrade those plugins. And finally if all else fails if you are not already running a SSD I would recommend getting one, it will drastically increase performance and I would not be surprised at all if it fixed the problem.

    Hope this helps!
    P.S. Try playing around with your Spigot/Bukkit build if that is causing some sort of conflict with the plugin.
     
  5. Jigsaw

    Supporter

    I am using MySQL for all of my plugins that have it as an option. That includes mcMMO, Jobs, LogBlock, and LWC. I have never had this problem before Spigot #430 and it happened again tonight with Spigot build #430. That is the second time it happened on that build. It usually happens when the server has been online for ~10+ hours. I have now updated to Spigot #447 and hopefully it doesn't happen anymore.
     
  6. Well, I think a simple fix for this would be to schedule automated restarts if you haven't. Preferably set them to every four hours for ultimate performance however if you think that is to short set them to six. Ten hours is quite a long while for a server to be running without restart when it is using such plugins.

    This is all expecting that updating the spigot build doesn't fix it.