Home All Groups Group Topic Archive Search About

Diagnosing System.IO.IOException

Author
23 Aug 2006 11:37 AM
Ricci
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?

Author
23 Aug 2006 12:00 PM
pvdg42
Show quote
"Ricci" <daoc@online.nospam> wrote in message
news:C05675F4-18CC-4D79-A2D3-7588FB440DB3@microsoft.com...
>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.
Author
23 Aug 2006 1:02 PM
Ricci
"pvdg42" wrote:

> 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.
Author
23 Aug 2006 4:58 PM
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.


Show quote
"Ricci" <daoc@online.nospam> wrote in message
news:9B5224B6-8E3A-4606-8AE7-FF3E7222FCF1@microsoft.com...
> "pvdg42" wrote:
>
>> 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.
Author
23 Aug 2006 10:28 PM
Ricci
"Kevin Spencer" wrote:

> 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 ?
Author
24 Aug 2006 11:47 AM
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.


Show quote
"Ricci" <daoc@online.nospam> wrote in message
news:E3A923C7-CC5E-4011-A556-2AE5E33B7A37@microsoft.com...
> "Kevin Spencer" wrote:
>
>> 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 ?

AddThis Social Bookmark Button