in reply to How to debug "Too Many Open Files" Error
On my system two of the messages are:perl -le 'print ($! = ++$_) until $! = ~/^Unknown/'
The first message would indicate a global problem on my machine, the second one that is specific to my process.Too many open files in system Too many open files
If it is global, you need to look at what is happening on the machine as a whole. It may not be easily fixable (though in Linux you can get them to up the limits, as others have told you.) If it is local to your process then the change in behaviour is driven by data that you have. Somehow you're opening files and not closing them. Without looking at your code I can't tell you where that is happening. However what you need to do is close some of your open files.
You can do this explicitly, or by using the built-in FileCache to close and reopen filehandles behind the scenes. Do note that it has a bug where it does not reset the position of filehandles if it opens and closes them. If that matters to you then I would create a tied class that can open and close files like FileCache does but also keeps track of positions.
If the problem is global it might still be the fault of your process. Aggressively avoiding multiple files open is not a bad idea. But the odds are that you aren't the culprit of the system problem. Instead it has to do with system load and, somewhere, some process is using lots more filehandles than it needs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to debug "Too Many Open Files" Error
by tonyb48 (Novice) on Sep 16, 2008 at 23:30 UTC | |
by tilly (Archbishop) on Sep 17, 2008 at 03:56 UTC | |
by kubrat (Scribe) on Sep 17, 2008 at 15:29 UTC | |
by tonyb48 (Novice) on Sep 17, 2008 at 22:35 UTC | |
by tonyb48 (Novice) on Sep 17, 2008 at 19:52 UTC | |
by chrism01 (Friar) on Sep 17, 2008 at 01:51 UTC | |
by kubrat (Scribe) on Sep 17, 2008 at 15:24 UTC |