Single 512-byte write to file taking 5-10 minutes

Single 512-byte write to file taking 5-10 minutes

Post by Gary Chans » Thu, 29 Jun 2006 10:30:47

< XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

Even reading a 2GB file from beginning to end shouldn't take that long.
I'd suggest checking your drive for bad sectors. Try to watch the disk test
closely to detect if it is doing a lot of retries which eventually succeed.


- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools


Single 512-byte write to file taking 5-10 minutes

Post by Cymbal Man » Thu, 29 Jun 2006 14:02:35

Maybe it's the nVidia IDE/ATA drivers, use M$ IDE/ATA drivers instead.

Or, the nForce 1, 2, 3, or 4 is the problem chip on the mobo. Try 5 and see if
that works better.

I dunno. Interesting question though.


Single 512-byte write to file taking 5-10 minutes

Post by Phil » Fri, 30 Jun 2006 23:54:39

The problem turned out to be AVG anti-virus scanning the file. There were
several aspects of the problem that made is confusing.

1. The files having the problem had the extension mpdwhich is something
I came up with. AVG shows a list of potentially nfectablefiles that it
scans, and mpd is not in that list.

2. I was under the belief that anti-virus programs did their real-time scans
of files at the time that a file was closed after being created or modified.
I had no idea that they would take control of a file and scan it while
another program had it open and was actively reading and writing to it.

3. The FileMon utility did not show any activity from any of the AVG
components while the file scan was taking place. I now assume that AVG must
install some sort of driver that hooks into Windows so that the scanning is
associated with Windows and my application rather than their components.

After receiving several suggestions that the problem was connected to
anti-virus scanning, I tried turning off the real-time protection component
of AVG by unchecking the appropriate box. That did _not_ solve the problem.

I then decided to try changing the types of the files. When I used Windows
Explorer to rename one of the files from .mpd to another extension which I
know to be safe, a full file scan took place during the rename operation,
causing Windows Explorer to hang for about 10 minutes. At that point I knew
I was on to something.

I have now modified my program to use different file extensions, and the
problem is solved.

Thank you for your help and suggestions.