
#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: