[GHC] #7646: resource busy (file is locked) with multi-threaded file ops

#7646: resource busy (file is locked) with multi-threaded file ops ----------------------------------------+----------------------------------- Reporter: StefanWehr | Owner: Type: bug | Status: new Priority: normal | Component: Runtime System Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- The sample program attached creates 10 worker threads, each of which takes a different file name. Each worker thread then writes the file, reads the file, writes the file and so on. File operations use *strict IO*. When compiled without `-threaded` everything is ok, that is, the program goes on forever without any error messages. But with `-threaded`, the program quickly fails with `ERROR in worker 4: 4: openBinaryFile: resource busy (file is locked)`. Tested under Mac OSX 10.8.2 and Linux. Tested with both GHC 7.6.1 and 7.6.2. I could reproduce the bug without +RTS -N -RTS and with this RTS option. A colleague of mine reports that it needs +RTS -N2 -RTS to reproduce the bug. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7646: resource busy (file is locked) with multi-threaded file ops ----------------------------------------+----------------------------------- Reporter: StefanWehr | Owner: Type: bug | Status: new Priority: normal | Component: Runtime System Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by dleuschner): * cc: leuschner@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7646: resource busy (file is locked) with multi-threaded file ops ----------------------------------------+----------------------------------- Reporter: StefanWehr | Owner: Type: bug | Status: new Priority: normal | Component: Runtime System Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Comment(by carter): I can replicate the bug on my machine. Interestingly enough, when I use BS.appendFile instead of BS.writeFile, the bug doesn't happen! I will try to use that information to sort out what may be happening. (or at least attempt to) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7646: resource busy (file is locked) with multi-threaded file ops ----------------------------------------+----------------------------------- Reporter: StefanWehr | Owner: Type: bug | Status: new Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by dleuschner): * version: 7.6.1 => 7.6.2 Comment: Thank you for looking into this issue, Carter! I assume it might affect more users than we might think, because the error message is typically associated with the lazy-IO problem of first (incompletely) reading and then writing. For me it still doesn't work with appendFile. The output still is: {{{ $ ghc -threaded -rtsopts --make GhcBug.hs && ./GhcBug +RTS -N2 started worker 3 started worker 2 started worker 5 started worker 7 started worker 9 started worker 1 started worker 4 started worker 6 started worker 8 started worker 10 GhcBug: ERROR in worker 1: 1: openBinaryFile: resource busy (file is locked) ERROR in worker 1: 1: openBinaryFile: resource busy (file is locked) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7646: resource busy (file is locked) with multi-threaded file ops ---------------------------------+------------------------------------------ Reporter: StefanWehr | Owner: simonmar Type: bug | Status: new Priority: high | Milestone: 7.6.3 Component: libraries/base | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Incorrect result at runtime Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonmar): * owner: => simonmar * difficulty: => Unknown * priority: normal => high * component: Runtime System => libraries/base * milestone: => 7.6.3 Comment: Fix coming, thanks for the report. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7646: resource busy (file is locked) with multi-threaded file ops
---------------------------------+------------------------------------------
Reporter: StefanWehr | Owner: simonmar
Type: bug | Status: merge
Priority: high | Milestone: 7.6.3
Component: libraries/base | Version: 7.6.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Changes (by simonmar):
* status: new => merge
Comment:
{{{
commit fbd4b4c2587636811d464040e349d81fac9e1121
Author: Simon Marlow

#7646: resource busy (file is locked) with multi-threaded file ops ---------------------------------+------------------------------------------ Reporter: StefanWehr | Owner: simonmar Type: bug | Status: merge Priority: high | Milestone: 7.6.3 Component: libraries/base | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Incorrect result at runtime Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Comment(by dleuschner): Thank you very much, Simon! We will miss you! :-) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7646#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC