#4835: Segfault when reading lots of files
---------------------------------+------------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Windows | Blocking:
Architecture: Unknown/Multiple | Failure: Runtime crash
---------------------------------+------------------------------------------
Given the program:
{{{
module Main(main) where
import Control.Monad
main :: IO ()
main = do
putStrLn "Starting segfault..."
xs <- replicateM 5000 $ do
src <- readFile "Main.hs"
src <- length src `seq` return (lines src)
return $ zipWith (++) src src
writeFile "out.txt" $ unlines $ concat xs
src <- readFile $ "out.txt"
length src `seq` return ()
putStrLn "Test complete, no segfault"
}}}
If I run GHC 7.0.1 on Windows, I see:
{{{
$ ghc --make Main.hs && main
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main.exe ...
Starting segfault...
Segmentation fault/access violation in generated code
}}}
The code segfaults about 50% of the time, slightly more if it has to build
the program (since I guess that flushes stuff out of the disk cache, or
slows down some operations). This bug has been boiled down from Hoogle,
which hits it for real. I haven't been able to reproduce the bug on GHC
6.12.3, but the original bug occurred there too, so I suspect some variant
of this bug also effects 6.12.3.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4835>
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