|
|
|
We're experiencing very similar behavior. We have a simple logger object that has existed since .NET 1.0. Ever since upgrading to .NET 2.0 (and beyond), we get occassional "File In Use" errors. When looking at what modules have open handles to our log file, it is always our own program. We have tried numerous ways to open/append to a text file without any luck. If you find a resolution, we would appreicate it if you could post it.
Chris Walls |
05.22.08 - 12:01 pm | #
|
|
This is a very tricky thing to debug and diagnose.
I highly doubt it’s a .NET bug. I’d bet a soda that the problem (bug? undecided if that classification is correct) is coming from something like the filesystem not being able to process all the IO quickly enough or from something external like AV filesystem filter driver.
We had a problem similar to this several years ago—every once in a while, we’d get an ERROR_ACCESS_DENIED where we clearly should not when deleting and recreating a directory (actually it was MSI code, not ours, and incidentally it was native code). What was actually happening was when we tried to recreate the directory, the filesystem returned STATUS_DELETE_PENDING (we had deleted the directory, but the fs only marks the file as "delete pending" and had not yet been able to get around to actually nuking it), and then the NT runtime translated this to ERROR_ACCESS_DENIED.
The $64,000 question was: is it a bug? It seemed an obvious “yes” at first, but after some thought it became more cloudy.
Certainly, a better error code would be better (why didn't they translate to ERROR_DELETE_PENDING? If they changed that now, would it break a bunch of legacy software?). And the behavior of the fs being unexpectedly sort of asynchronous seems odd, but if that were changed, what would happen to perf?
Anyway, that was our problem, not quite like the one you describe here. For this one, is there any Anti-Virus software, special indexing software, or anything like that that might be getting involved? Have you tried using ProcessMonitor to log all access to the file?
Dan Thompson |
11.04.08 - 5:18 pm | #
|
|
Commenting by HaloScan
|