To many open files
Posted: Wed Dec 15, 2021 2:50 pm
Hi,
I've run into this before and now it's back "To many open files". Resulting in a script CRASH! Running on WinPE build from latest Win10 prof build x64 version.
The documentation says "Note: Although the script interpreter will make sure that all opened files are closed eventually, you should explicitly
close any files you open. This will prevent you from running out of file handles if your script needs to open several files."
I have of course made sure that I only keep file handlers open when required (forcing me to open and close the log files over and over for each line written with obvious detremental effects!)
A few questions:
- How many file handlers are allowed? I would assume 512/2048/16384 however, from testing it seems to be 5! Really?
- Can I view what handlers are open? If so how.
- Can I have it error and return the fabled -1 instead of crashing? If so how. The crashing and not having a proper error mechanism is one of the biggest issues in tbsscript, only superseeded by the ever so fun gues what my type and or value is in what I like to call are there miss spelled variables roulet...
- Can I increase the number of allowed file handlers? I'm running on a dual proc Xeon which supports 64 threads and has almost a TB of RAM.
My test for open file handlers allowed:
Sub Main()
i = 0
files = 0
While (1 = 1)
i = i + 1
PrintL(i)
files = open(test # i)
wend
End Sub
I've run into this before and now it's back "To many open files". Resulting in a script CRASH! Running on WinPE build from latest Win10 prof build x64 version.
The documentation says "Note: Although the script interpreter will make sure that all opened files are closed eventually, you should explicitly
close any files you open. This will prevent you from running out of file handles if your script needs to open several files."
I have of course made sure that I only keep file handlers open when required (forcing me to open and close the log files over and over for each line written with obvious detremental effects!)
A few questions:
- How many file handlers are allowed? I would assume 512/2048/16384 however, from testing it seems to be 5! Really?
- Can I view what handlers are open? If so how.
- Can I have it error and return the fabled -1 instead of crashing? If so how. The crashing and not having a proper error mechanism is one of the biggest issues in tbsscript, only superseeded by the ever so fun gues what my type and or value is in what I like to call are there miss spelled variables roulet...
- Can I increase the number of allowed file handlers? I'm running on a dual proc Xeon which supports 64 threads and has almost a TB of RAM.
My test for open file handlers allowed:
Sub Main()
i = 0
files = 0
While (1 = 1)
i = i + 1
PrintL(i)
files = open(test # i)
wend
End Sub