[GHC] #7636: threadStackUnderflow: not enough space for return values

GHC cvs-ghc at haskell.org
Tue Jan 29 01:47:10 CET 2013


#7636: threadStackUnderflow: not enough space for return values
-------------------------+--------------------------------------------------
Reporter:  mojojojo      |          Owner:                
    Type:  bug           |         Status:  new           
Priority:  normal        |      Component:  Compiler      
 Version:  7.4.2         |       Keywords:                
      Os:  MacOS X       |   Architecture:  x86_64 (amd64)
 Failure:  None/Unknown  |      Blockedby:                
Blocking:                |        Related:                
-------------------------+--------------------------------------------------

Comment(by mojojojo):

 My program has the following structure, but unfortunately that code does
 not reproduce the bug. I'm willing to answer any questions and if it will
 help I can post some partial code of my app, which won't compile due to
 being partial, but may help you with the analysis of the situation.

 In the actual program in the eater and feeder functions there happen HTTP
 and database requests.

 {{{
 import Control.Monad
 import Control.Monad.Trans
 import Control.Concurrent
 import Control.Concurrent.STM
 import Control.Concurrent.STM.TBQueue
 import qualified Data.Vector as Vector

 main = do
   valuesQueue <- atomically $ newTBQueue 50000

   forkIO $ runEater valuesQueue

   runFeeder valuesQueue 0


 runFeeder valuesQueue offset = do
   putStrLn $ "Feeding " ++ show feederBatchSize ++ " values"
   let values = replicate feederBatchSize $ "A"
   if offset >= 10000000
     then putStrLn "Reached the end"
     else do
       atomically $ forM_ values $ writeTBQueue valuesQueue
       runFeeder valuesQueue (offset + feederBatchSize)

 runEater valuesQueue = do
   values <- atomically $
     Vector.replicateM eaterBatchSize (readTBQueue valuesQueue)
   putStrLn $ "Eating " ++ (show $ Vector.length values) ++ " values"
   runEater valuesQueue



 feederBatchSize = 10000
 eaterBatchSize = 500
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7636#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list