#3542: ghc-cabal deadlocks
-------------------------------+--------------------------------------------
  Reporter:  igloo             |          Owner:                  
      Type:  bug               |         Status:  new             
  Priority:  high              |      Milestone:  6.12.1          
 Component:  Build System      |        Version:  6.10.4          
  Severity:  normal            |       Keywords:                  
Difficulty:  Unknown           |       Testcase:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-------------------------------+--------------------------------------------
 Trying to build an OS X installer is currently deadlocking when
 {{{
 inplace/bin/ghc-cabal install
 
/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925
 /ghc-stage2
 
/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925
 /ghc-pkg
 
/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925
 compiler stage2 /Users/ian/ghc/6.12-branch/val/dest
 /Users/ian/ghc/6.12-branch/val/inst
 /Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925
 /Users/ian/ghc/6.12-branch/val/inst/share/doc/ghc/html/libraries
 }}}
 runs:
 {{{
 
/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925
 /ghc-pkg --global-conf
 
/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925/package.conf.d
 --force update - --global
 }}}

 Linking `ghc-cabal` with `-threaded` fixes the problem. I believe the
 problem is that when we are using a `DESTDIR` we get a large amount of
 warnings (more than a buffer full) like:
 {{{
 ghc-6.12.0.20090925: file AsmCodeGen.hi is missing (ignoring)
 }}}
 so Cabal's `Distribution.Simple.Utils.rawSystemStdin`:
 {{{
       _ <- forkIO $ do _ <- evaluate (length err); return ()
       _ <- forkIO $ do _ <- evaluate (length out); return ()

       -- push all the input
       hPutStr inh input
       hClose inh

       -- wait for the program to terminate
       exitcode <- waitForProcess pid
       unless (exitcode == ExitSuccess) (die err)
 }}}
 deadlocks unless it is compiled with `-threaded`, as the forked evaluate
 threads don't get a chance to run.

 The simple fix is to link with `-threaded`, but I'm not sure that we want
 to assume that `-threaded` works - especially as it needs to work in the
 bootstrapping compiler.

 Can we eliminate calls to this, and any other problematic, functions?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3542>
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

Reply via email to