#4514: System.Timeout cannot properly cancel IO actions with new IO manager
---------------------------------+------------------------------------------
    Reporter:  adept             |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  Runtime System             
     Version:  7.0.1             |    Keywords:                             
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------

Comment(by adept):

 Here is variant with Sockets instead of Handles, same bug present:

 {{{
 module Main where

 import Control.Concurrent
 import Network
 import Network.Socket as S
 import System.IO
 import System.Timeout

 main :: IO ()
 main = do
     s <- listenOn (Service "7000")
     loop s
     return ()

 loop :: Socket -> IO ThreadId
 loop s = do
     (s',_) <- S.accept s
     forkIO $ echo s'
     loop s

 echo :: Socket -> IO ()
 echo s = do
     mstr <- timeout 5000000 $ recv s 1000
     case mstr of
         Just str -> do
             send s str
             echo s
         Nothing -> do
             putStrLn "Time out"
             sClose s
             return ()
 }}}

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