[GHC] #7599: timeout does not behave as expected

GHC cvs-ghc at haskell.org
Thu Jan 17 00:21:41 CET 2013


#7599: timeout does not behave as expected
----------------------------------------+-----------------------------------
Reporter:  ique                         |          Owner:                                 
    Type:  bug                          |         Status:  new                            
Priority:  normal                       |      Component:  libraries/base                 
 Version:  7.6.1                        |       Keywords:  System.Timeout timeout base-4.6
      Os:  MacOS X                      |   Architecture:  x86_64 (amd64)                 
 Failure:  Incorrect result at runtime  |      Blockedby:                                 
Blocking:                               |        Related:                                 
----------------------------------------+-----------------------------------
 In trying to debug an error I found using the MongoDB package (it was
 refusing connections) I found what I believe is a bug with System.Timeout.

 When connecting with connectTo I immediately get a handle, wrapped in
 timeout with a positive timeout, it instantly returns Nothing. When using
 a negative timeout (wait indefinitely) it instantly returns the proper
 Handle.

 Below is a minimal test-case that I ran in ghci.

 Import System.Timeout

 Import Network

 timeout (-1) $ connectTo "127.0.0.1" (PortNumber 27017)
  -- This returns: Just {handle: <socket: 9>}

 timeout 1000000 $ connectTo "127.0.0.1" (PortNumber 27017)
  -- This returns Nothing

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



More information about the ghc-tickets mailing list