File being used by another process

My "Write to text file" actions seem to keep failing with this error:

File edit failed: Cannot create file "c:\testbuild\bigfoo.txt". The process cannot access the file because it is being used by another process

Originally I assumed it was because I was opening the file for reading in another program while still writing to it. But it's happening even when I don't do that, if a build is running fast and frequently writing to the same file. It seems that FB trips over its own feet while writing.

Steve

We’ll look into this.

Hi Steve,

Are any other actions or processes touching this file, or just Write To Text File? Write To Text File should be cleanly closing the file each time it runs, it shouldn’t be possible for it to “trip over its own feet” unless you’re using Async Action Groups.

Does it only happen occasionally, or all the time? When it does occur, does restarting Finalbuilder make it go away?

Regards,

Angus

It only happens occasionally: maybe one time in 1000 or so. I think this could just be a Windows anomaly - I have a similar issue with Bazaar, which sometimes is unable to delete its own .lock files, because “another process” is still using them. In general, simply retrying the action after a few seconds’ pause succeeds.

At the time these problems happen, there really should be nothing else touching the file. As in, I’ll have an FB build going overnight, with nothing else of any interest running, and like the 1000th time it writes to the file, it will create an exception which I catch, then the next time it writes will succeed.

Of course, the fact that I’m having a very similar issue with two different programs suggests that possibly it’s my computer - I’ll try disabling virus checkers and stuff and see if that helps.

Steve

You might also try turning off the Indexing Service. The indexer will often open a file up right after you’ve written to it and I’ve sometimes tripped over it.

On XP, right-click My Computer-> Manage -> Services and Applications -> Services, find Indexing Service and stop it. You may also need to set it to manual.

Disabling it will make searches go slower, but might eliminate your “file in use” issues.

A good tool to help figuring out this sort of thing is Unlocker. it will show you what process has the file open. It’s at http://ccollomb.free.fr/unlocker.

Keith

Good suggestions, thanks very much!

Steve