#1992: 6.8.2 intermittent build failure on multiple OS X versions
----------------------+-----------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.8.3
Component: Compiler | Version: 6.8.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Multiple
Os: MacOS X |
----------------------+-----------------------------------------------------
Comment (by gw):
Once you see it, the bug is obvious. In rts/posix/FileLock.c, the
lockFile
routine only records a pointer from the first fd seen to the lock
structure.
If another fd read locks the same file, the second fd isn't recorded in
the fd_hash,
and the read lock count is not decremented when the second fd is closed.
Here is the patch that fixes the problem:
{{{
--- rts/posix/FileLock.c.sav 2008-02-20 05:47:14.000000000 -0500
+++ rts/posix/FileLock.c 2008-02-20 05:48:28.000000000 -0500
@@ -88,6 +88,12 @@
if (for_writing || lock->readers < 0) {
return -1;
}
+
+ // have we seen this fd before?
+ if (lookupHashTable(fd_hash, fd) == NULL) {
+ insertHashTable(fd_hash, fd, lock);
+ }
+
lock->readers++;
return 0;
}
}}}
The last test in ghc-regress/lib/IO/openFile005 does put the hash tables
into an
inconsistent state, without tripping over the bug. I've added a test to
trigger it.
I'll darcs send these as patches to the 6.8 branch.
The problem is not specific to OS X. It's still a bit puzzling why no one
else
has seen it, although as I mentioned before, it may have caused the
version
detection failure seen in Cabal.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1992#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs