views:

229

answers:

6

My application writes some bytes of data to an alternate data stream. This works fine on all but one machine (Windows Server 2003 SP2). Instead, CreateFile returns ERROR_DISK_FULL when I try to create an alternate data stream (on the root directory). I don't find the reason for this result, because...

  • There's plenty of space on that drive.

  • The drive is NTFS formatted (due to GetVolumeInformation).

  • The drive supports altenate data streams (due to GetVolumeInformation).

Edit: I can provide some more information about what the reason not is: I added many streams on a test system which didn't show the error and wondered if the error might occur. It didn't. Instead after about 2000 Streams with long file names another error occurred and persisted: 1450 (ERROR_NO_SYSTEM_RESOURCES).

EDIT: Here is an example for one of the used file names:

char szStreamFileName[] = "C:\\:abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnoqrstuvwxyz012345";

EDIT: Our customer uses some corporate antivirus software from Avira on this server. Maybe this is the reason (Alternate data streams can be abused by malware).

A: 

Just a blind shot, but are the rights set properly?

Pekka
Yes, it doesn't look like missing privileges. The user executing the appications has admin rights. Also, I tried to cause errors due to insufficient rightsand got error 5 as expected.
ur
A: 

Just another possibility...

Did you check the number of currently opend files in your OS? The OS support max. number of reserved file handles after that report ERROR_DISK_FULL or ERROR_NO_SYSTEM_RESOURCES.

And second possibility... The root directory is limited by number of files. As I remember 512 files in older versions of OS. But the NTFS support unlimited number of files in root!

GJ
Thank you for your hints. I guess the second can't be the reason, but for the first I will let the customer retry after a system reboot (I think he did anyway). My application doesn't open many files, but I will have him check the overall opened files with openfiles.exe.
ur
Maybe has some application or process a bug end doesn't relase alocated handles. You can check the number of alocated handles per procces in 'Windows Task Manager' in process window, handles are not visible by default you must switch on 'View/Select Columns/Handle Count'. All resource handles are important and not only file handles they are useing the same memmory.
GJ
+1  A: 

Are there any compressed/spare files or alternate data streams?

Often backup applications receive ERROR_DISK_FULL errors attempting to back up compressed files and this causes quite a bit of confusion when there are still several gigabytes of free space on the drive. Other issues may also occur when copying compressed files. The goal of this blog is to give the reader a more thorough understanding of what really happens when you compress NTFS files.

From Understanding NTFS Compression

Michael
OK, that does not seem to fit to your problem.
Michael
Thank you for that hint, I will check this. I dont't use sparse files in my application, but maybe the disk/folder is compressed.
ur
Customer has responded: The drive / folder isn't compressed.
ur
A: 

You might want to see what something like Sysinternal's Process Monitor utility captures when trying to create this file - it show the return codes of various APIs involved in the I/O stack and one of them might give you a clue as to why 112 is being returned to you. Hopefully the level of detail in ProcMon is enough - if not, I imagine there are other, more detailed I/O trace facilities for Windows (but I don't know of them off the top of my head)

Michael Burr
I would like to try that but the machine is at one of our customers and I have no direct access to it. I can't reproduce the behviour here on one of our machines.
ur
A: 

The filename you give is

char szStreamFileName[] = "C:\\:abcdefghijklm...

it starts with

C:\\:

Is that a typo on the post, or is there really a colon after the slash? I think thats a illegal filename.

RED SOFT ADAIR
No, no typo - this is perfectly legal for alternate data streams.
ur
A: 

If you try to copy a file greater than 2GB from another filesystem (NTFS) to FAT / FAT32 which has a 2GB limit you may see this error.

brewester93
There's no FAT/FAT32 in the game. The error occurs simply when I execute CreateFile for the alternate data stream on the NTFS drive.
ur