Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6167573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:32:12+00:00 2026-05-23T22:32:12+00:00

My program basically looks like this: using(XmlReader reader = XmlReader.Create(File.Open(path, FileMode.Open, FileAccess.Reader, FileShare.Read)) {

  • 0

My program basically looks like this:

using(XmlReader reader = XmlReader.Create(File.Open(path, FileMode.Open, FileAccess.Reader, FileShare.Read))
{
    //a lot of reader.Read() to read through the file
}

The program reads a large amount of small files this way (typically 5k per second) and on local machines this works properly. However I’m now trying to feed it input data from a remote machine. I’ve created an NTFS symlinked folder to the remote host on my local drive. So when my machine accesses C:\MyFolder it transparently accesses \NetworkComputer\MySharedFolder. So far so good!

Howevermy program crashes with a “The system cannot open the file.” IOException. This seems to map to “ERROR_TOO_MANY_OPEN_FILES”. As far as I know I only have one file open at a given time, so the exception doesn’t make sense.

After some more debugging I found out the following (using the process explorer).

When running locally the process starts with 400 handles (probably because of .NET) then when I press the start button the number of handles increases to 600 quickly, then it decreases to 400, then rises to 600, etc… This is probably the Garbage Collector kicking in, keeping the number of file handles down. When the process is done processing the files the number of file handles returns nicely to 400.

When reading files from the remote machine I see in the local process monitor the exact same behavior. However in the process monitor on the remote machine I see the number of file handles rise with about 1800, never decreasing, until the program crashes. The file handle number increase on the remote machine directly corresponds with the number of processed files.

TLDR:
So this is my question: How can I avoid having dangling file handles on a remote machine when accessing it trough a symlink?

Edit:

Sometimes another exception shows up (IOException) “Not enough server storage is available to process this command”. I’m not sure how to counter this, but I found some extra info, still not sure what this means http://support.microsoft.com/kb/285089 http://support.microsoft.com/kb/106167

Edit2:

One solution that seems to help is to slow down reading from the remote machine, by throttling to 2000 files per minute resolves the problem, but this is not really a working solution since then the job takes about 10x longer then it has to take.

I’ve also found some articles that indicate that increasing IRPSstacksize could do the trick, however since the computer is not directly under my control this might not be possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:32:13+00:00Added an answer on May 23, 2026 at 10:32 pm

    I am not sure whether this behaviour is due accessing a remote machine or due to accessing via symlink…

    Perhaps you can just check the behaviour when accessing the remote machine without a symlink – through UNC path and/or drive letter (smb mount)…

    I can’t be a 100% sure but I think the symlink is part of the problem…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm reading in a file (like java program < trace.dat) which looks something
I am using a facade design pattern for a C# program. The program basically
So I've built this mail-program-like HTML viewer (no real emails, just some messages from
I'm doing an expression valuation program, just like this . My problem is that
I've got a routine that looks something like this, in pseudocode: while PeekMessage(Message, 0,
My program goes through a loop like this: ... while(1){ read(sockfd,buf,sizeof(buf)); ... } The
Basically, is it possible to identify if some-one hooks up my program to SQL
What program can I use to decompile a class file? Will I actually get
Strange program hang, what does this mean in debug? After attaching windbg I found
Preamble Using VTK library with C++, quite often I have to write something like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.