Re: [Haskell-cafe] File locked unnecessarily

2006-12-04 Thread Ian Lynagh
On Sun, Dec 03, 2006 at 08:13:37PM +0100, Arie Peterson wrote:
 
 Does anyone know what could cause this locking and/or how to prevent it?

Nothing else springs to mind. Are you able to send an example that shows
the problem? (obviously the smaller the example, the better).


Thanks
Ian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] File locked unnecessarily

2006-12-03 Thread Vyacheslav Akhmechet

Are you using hGetContents? If you are, take a closer look at the
documentation. The function creates a lazy stream and until you finish
reading from it the file will be in the semi-closed state (which
means it will be locked).

On 12/3/06, Arie Peterson [EMAIL PROTECTED] wrote:

Hi,


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,


Arie

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe