Opened 3 years ago

Closed 3 years ago

#7599 closed bug (duplicate)

timeout does not behave as expected

Reported by: ique Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 7.6.1
Keywords: System.Timeout timeout base-4.6 Cc:
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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 "" (PortNumber 27017)

-- This returns: Just {handle: <socket: 9>}

timeout 1000000 $ connectTo "" (PortNumber 27017)

-- This returns Nothing

Change History (1)

comment:1 Changed 3 years ago by simonmar

  • difficulty set to Unknown
  • Resolution set to duplicate
  • Status changed from new to closed

threadDelay isn't working properly in GHCi in 7.6.1 on OS X (#7299), I think this is a symptom of the same problem. Please re-open if it still occurs after #7299 is fixed.

Note: See TracTickets for help on using tickets.