Hi all,
I am trying to debug a user mode application that is writing some very large
files (> 50 GBytes) to an NTFS file system. These files are being written
as normal, nonoveralapped, buffered files.
The difficulty that I am having is that when I am writing two of these files
at once (along with a few other small files), I eventually get an error 183
(“Cannot create a file when that file already exists.”) from the WriteFile
call. This usually happens when the file reaches around 30 GBytes. I figured
this was a bad interpetation of some other kernel mode error, so I ran
FileMon on the system in question. It turns out that the error actually
coming back from NTFS is 0xc000009a (STATUS_INSUFFICIENT_RESOURCES). So it
appears that NTFS is running out of something it needs. As an obvious test,
I doubled the physical memory in system and 4x the size of the pagefile.
This had no effect on the problem, it still happens about the same place.
Here is an example from FileMon of the failure:
15889684 3:54:22.920 PM FileZilla Serve:1888 IRP_MJ_WRITE
R:\WUtemp2\bigfile_cp0.mxf * 0xC000009A Offset: 29187456796 Length: 8688
Then I started looking at the FileMon output. Here I am finding 3 behaviors
that I don’t understand. I am hoping someone can enlighten me.
- All of the IO’s are being tried first as a FAST_IO, which is failing.
That is fine, but then the IO is retried as an IRP, but the offset is
different than the FAST_IO was?? Here are a few example lines from filemon.
15889658 3:54:22.873 PM FileZilla Serve:1888 FASTIO_WRITE
R:\WUtemp2\bigfile_cp0.mxf FAILURE Offset: 3417583428 Length: 8688
15889659 3:54:22.873 PM FileZilla Serve:1888 IRP_MJ_WRITE
R:\WUtemp2\bigfile_cp0.mxf SUCCESS Offset: 29187387204 Length: 8688
15889660 3:54:22.873 PM FileZilla Serve:1888 FASTIO_WRITE
R:\WUtemp2\bigfile_cp0.mxf FAILURE Offset: 3417592116 Length: 8776
15889661 3:54:22.873 PM FileZilla Serve:1888 IRP_MJ_WRITE
R:\WUtemp2\bigfile_cp0.mxf SUCCESS Offset: 29187395892 Length: 8776
15889662 3:54:22.889 PM FileZilla Serve:1888 FASTIO_WRITE
R:\WUtemp2\bigfile_cp0.mxf FAILURE Offset: 3417600892 Length: 8688
15889663 3:54:22.889 PM FileZilla Serve:1888 IRP_MJ_WRITE
R:\WUtemp2\bigfile_cp0.mxf SUCCESS Offset: 29187404668 Length: 8688
as you can see, the write is attempted first as a fastio_write at offset
3417583428, when this fails, the IRP is issued at offset 29187387204. I
don’t understand this huge difference in offsets. Does any one understand
this?
- Here is the biggest mystery. Although I am seeing thousands of
successful IRP_MJ_WRITE calls, I NEVER see any calls from the LazyWriter to
these large files. For smaller files, I usually see something like this:
several cached writes:
15525500 3:48:30.733 PM FileZilla Serve:1888 FASTIO_WRITE
R:\WUtemp2\bigfile_cp0_1.wav SUCCESS Offset: 437310766 Length: 1448
finally the uncached write:
15541757 3:48:41.905 PM System:4 IRP_MJ_WRITE* R:\WUtemp2\bigfile_cp0_1.wav
SUCCESS Offset: 437436416 Length: 65536
However, for the big files, I see thousands of cached writes and never any
uncached writes. Also, the FASTIO_WRITES are succeeding for these smaller
files. Any ideas??
- I am seeing a large number of uncached writes to an NTFS stream called
R:$ConvertToNonresident. These seem to have some loose relationship to the
writes taking place to the large file.
So I am generally wondering what is going on here. Why am I not seeing the
physical writes from the cache manager? It almost seems as if NTFS is
turning the cachedwrites into non-cached writes internally.
I would really appreciate any insight or ideas that anyone might have.
Thanks,
Don Edvalson