[GHC] #13504: registerTimeout can wait too little because it uses Doubles for times

#13504: registerTimeout can wait too little because it uses Doubles for times -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 8.0.2 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- [https://github.com/ghc/ghc/blob/380b25ea4754c2aea683538ffdb179f8946219a0/lib... registerTimeout] uses `getMonotonicTime :: IO Double` and thus goes a roundtrip to `Double` when it is perfectly possible to always work on integers instead (`getMonotonicTime` obtains integers and then converts it). This can result in functions like `timeout` to wait too little, as e.g. `timeout 4` is converted to `3.997420` seconds, which can violate standard expecations of programs that it will wait _at least_ as much as demanded. We should export and use the integer based function [https://github.com/ghc/ghc/blob/380b25ea4754c2aea683538ffdb179f8946219a0/lib... GHC.getMonotonicNSec] that `getMonotonicTime` calls. Not going through Double will also make inspecting e.g. `strace` more obvious. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13504 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13504: registerTimeout can wait too little because it uses Doubles for times -------------------------------------+------------------------------------- Reporter: nh2 | Owner: nh2 Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nh2): * owner: (none) => nh2 * failure: None/Unknown => Incorrect result at runtime -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13504#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13504: registerTimeout can wait too little because it uses Doubles for times -------------------------------------+------------------------------------- Reporter: nh2 | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * owner: nh2 => bgamari -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13504#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13504: registerTimeout can wait too little because it uses Doubles for times -------------------------------------+------------------------------------- Reporter: nh2 | Owner: bgamari Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3417 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D3417 * milestone: => 8.4.1 Comment: Here is a quick (but rather under-tested) fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13504#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13504: registerTimeout can wait too little because it uses Doubles for times -------------------------------------+------------------------------------- Reporter: nh2 | Owner: bgamari Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3417 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Resolved in ab2dcb1c474d918efdc875f3cca7ef5b6ebdce1a. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13504#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC