[Haskell-cafe] File locked unnecessarily

Arie Peterson ariep at xs4all.nl
Sun Dec 3 14:13:37 EST 2006


After a partial rewrite of my webserver, it is suffering from locked files:

  /path/to/file: openBinaryFile: resource busy (file is locked)

The file in question really shouldn't be locked:
  - Only my server knows of the file's existence.
  - Only one thread accesses the file.
  - The thread accesses the file multiple times in quick succession,
opening and closing it each time, but debugging statements show that it
is properly closed before it is reopened.

I tried opening, reading/writing and closing a file continuously for some
time in an isolated environment, and that works without problems.

Also, my server did not have this file locking problem before the rewrite,
and the rewrite did not touch the part of the code that accesses the file.

This suggests that the locking is somehow triggered by the specific access
pattern of my code, if that is even possible.

Does anyone know what could cause this locking and/or how to prevent it?

I'm using ghc 6.4 on gentoo linux (amd64).

Thanks and greetings,


More information about the Haskell-Cafe mailing list