Ok, my bot has several scripts working with files and several ones working with sockets.
After a while (10-48 hours) it always gives me the message "too many open files". I can't find the script causing this error, that's why I'm asking:
How can I see the "opened files" or the number, how many files the bot has opened
and:
Can I increase this number and would this help me (my bot)?
'file channels' will give you a list of the currently open file channels. Increasing the max ammount would require you to recompile tcl (iirc), but it won't solve your problem. Make sure all your scripts 'close' file channels when they're done with them and everything should be fine
Ok, "file channels" gives me a very huge list!
But I can't see the script associated with the channel!
I really searched ALL my scripts for "open"s and "close"s and the number was equal and every "open" had its own "close"-command. But I still have an increasing number of file channels
You also have to make sure that the files are closed. If there's a return statement before the close, like inside an if or a loop, the file won't be closed. Same goes with sockets, which can be more problematic because they may be asynchronous, so tracking down the closing bit and making sure it's actually executed is harder.