Diagnosing System.IO.IOException

G

Guest

I have an application that generates and moves 1000s of small text files.

Every so often for some unknow reason I start to get the following 2
exceptions:


System.IO.IOException: Not enough quota is available to process this
command. at System.IO.Directory.GetFiles(String path, String searchPattern)

and (if the first exception does not happen we get a bit further and try to
move the files we found)

System.IO.IOException: Insufficient system resources exist to complete the
requested service. at System.IO.File.Move(String sourceFileName, String
destFileName)

I can see no problems with available memory, the app does not use huge
chunks of resources as far as I can tell from taskman and process explorer,
restarting the application clears the problem. Load on the app does not seem
to cause it as I can hit it VERY hard and it does not fail.. this leads me to
think it is down to another application or the OS.

Has anyone else seen this or got any good ideas on how to track the cause?
 
P

pvdg42

Ricci said:
I have an application that generates and moves 1000s of small text files.

Every so often for some unknow reason I start to get the following 2
exceptions:


System.IO.IOException: Not enough quota is available to process this
command. at System.IO.Directory.GetFiles(String path, String
searchPattern)

and (if the first exception does not happen we get a bit further and try
to
move the files we found)

System.IO.IOException: Insufficient system resources exist to complete the
requested service. at System.IO.File.Move(String sourceFileName, String
destFileName)

I can see no problems with available memory, the app does not use huge
chunks of resources as far as I can tell from taskman and process
explorer,
restarting the application clears the problem. Load on the app does not
seem
to cause it as I can hit it VERY hard and it does not fail.. this leads me
to
think it is down to another application or the OS.

Has anyone else seen this or got any good ideas on how to track the cause?

Depending on the application type, and how many files you have open
concurrently, you may want to look into file handle limitations.
 
G

Guest

pvdg42 said:
Depending on the application type, and how many files you have open
concurrently, you may want to look into file handle limitations.

Hi, there is never more than 1 file open, as soon as the data is written the
stream is closed before writing the next file. The errors are occuring after
all files have been written. After all files are written the app loads the
list of filesnames into a string array using Directory.GetFiles and then each
file is moved using File.Move

When the error occurs the number of files is 1000 at the most, usually about
300.
 
K

Kevin Spencer

File.Move involves file handles.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
 
G

Guest

Kevin Spencer said:
File.Move involves file handles.

errm, I am sure it does.. but looping through a list of files and doing
file.move on each one should only have 1 (or maybe 2 ?) handle open?? Or does
file.move keep handles open after the move has happened ?
 
K

Kevin Spencer

Assuming that your loop is running in the main thread, and that you are
moving one file at a time, yes, the file handles should open and close
during the loop. You said that the errors occur after the files are written.
Moving a file writes it to the new location. I was simply pointing out that
the error occurs during the process of the files being written (moved) to
their new location.

As to why you're getting the error, without knowing more about your process,
I couldn't say.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top