#14262: fdReady cannot wait more than 49 days -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8684, #13497, | Differential Rev(s): #14267 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"f209e6672fe33235bd1d4c20c87894021cf3bbc8/ghc" f209e667/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="f209e6672fe33235bd1d4c20c87894021cf3bbc8" base: fdReady(): Fix timeouts > ~49 days overflowing. Fixes #14262. On 64-bit UNIX and Windows, Haskell `Int` has 64 bits but C `int msecs` has 32 bits, resulting in an overflow. This commit fixes it by switching fdReady() to take int64_t, into which a Haskell `Int` will always fit. (Note we could not switch to `long long` because that is 32 bit on 64-bit Windows machines.) Further, to be able to actually wait longer than ~49 days, we put loops around the waiting syscalls (they all accept only 32-bit integers). Note the timer signal would typically interrupt the syscalls before the ~49 days are over, but you can run Haskell programs without the timer signal, an we want it to be correct in all cases. Reviewers: bgamari, austin, hvr, NicolasT, Phyx Reviewed By: bgamari, Phyx Subscribers: syd, Phyx, rwbarton, thomie GHC Trac Issues: #14262 Differential Revision: https://phabricator.haskell.org/D4011 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14262#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler