#4514: System.Timeout cannot properly cancel IO actions with new IO manager
---------------------------------+------------------------------------------
    Reporter:  adept             |       Owner:  tibbe                      
        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):

 Scratch my last comment. Lambda passed to registerFd should be captured
 inside event manager and unaffected by `killThread`. I have another
 explanation though.

 According to strace output, after I type "FINISH", see it echoed back to
 me and sit back, reader thread calls `recv`->`recvLen`->`threadWaitRead`,
 which registers callback for FD 11 with epoll.

 Then time out happens, and close(2) is called on FD 11. At this moment
 '''epoll drops all callbacks associated with FD 11'''.

 When I connect again, `threadWaitRead` calls `registerFd`, which refuses
 to update epoll status for reasons outlined above (`oldEvs == newEvs`). At
 the same time, epoll does not have callbacks for FD 11 anymore so the old
 callback already registered with Event Manager has no chance of firing.
 Strace confirms this: even though epoll_wait is called several times after
 I re-connect, it never returns events for FD 11.

 Therefore we arrive at a deadlock: old callback would never be executed,
 new callback would not be added, plus we have discrepancy in internal
 states of epoll and Event Manager: manager thinks that he has 1 callback
 for FD 11 registered, while epoll has zero callbacks for FD 11.

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