1

I am coming across an error when I am trying to write out a file (~50 MB) I will randomly get the following error:

IOException: Insufficient system resources exist to complete the requested service

I currently have 200+ GB free on the hard drive and about 20 GB free in memory. I am using protobuf to serialize the data out to disk. There are around four threads running similar operations at the same time on different files. There should not be anything else trying to access the file as it was just created with a random GUID. Here is the code I am using to write the information out to disk:

using (FileStream stream = File.Open(file, FileMode.Create, FileAccess.Write, FileShare.None))
{
    Serializer.Serialize<my_object>(stream, data);
}

Can anyone shed any light as to which system resource the IOException is referring to?

Thanks!

CodeSlinger512
  • 618
  • 1
  • 8
  • 23
  • 6
    It is a low-level Windows error, error code 1450, ERROR_NO_SYSTEM_RESOURCES. Tends to be due to exhaustion of the kernel memory pool. Not easy to trigger, heavy handle leakage is usually required. – Hans Passant Dec 13 '12 at 18:47
  • How could I be causing a handle leakage? Is there a way to curb it? – CodeSlinger512 Dec 13 '12 at 19:09
  • That's the thing about kernel-space: everyone shares the same pool. It might not even be your app that's doing it. Check the task manager, see if there are any processes with a large non-paged pool. – Cory Nelson Dec 13 '12 at 19:12
  • My application is coming in first for both NP Pool and handle count (596K & 2300, resp). The second place is 176K and 714, resp. – CodeSlinger512 Dec 13 '12 at 19:15
  • @Davidguygc did you have handle count and NP pool backwards? – Alan Dec 13 '12 at 19:15
  • @Alan, yes I did a quick edit to fix it, thanks for noticing – CodeSlinger512 Dec 13 '12 at 19:18
  • I've never seen it do this, but I'd be very interested if you have any kind of repro I can look at (I'm the author of protobuf-net); although it *looks* like this is more BCL-related – Marc Gravell Dec 13 '12 at 19:58
  • @MarcGravell, I'll see if I can't make a bare bones version of this and get it to replicate. I'd appreciate any help I can get – CodeSlinger512 Dec 13 '12 at 21:06
  • I'm wondering if a solution for this problem was found. I'm experiencing the same problem right now. – Eliseo Feb 04 '13 at 21:15
  • @Eli - I never was given the opportunity at work to create a bare bones version that successfully recreated the problem. Hopefully the workload will open up in the future for me to do so. Sorry that it's not the answer you were hoping for! – CodeSlinger512 Feb 05 '13 at 19:39

0 Answers0