registerTimeout can wait too little because it uses Doubles for times
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 GHC.getMonotonicNSec that getMonotonicTime
calls.
Not going through Double will also make inspecting e.g. strace
more obvious.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | nh2 |
Operating system | |
Architecture |