Make system IO interruptible on Windows
|Reported by:||joeyadams||Owned by:||refold|
|Keywords:||Cc:||idhameed@…, bos@…, shelarcy@…, dagitj@…, leon.p.smith@…, the.dead.shall.rise@…, hvr, ekmett, Phyx-, core-libraries-committee@…, drkoster@…|
|Type of failure:||Incorrect result at runtime||Test Case:|
|Related Tickets:||Differential Rev(s):|
Currently, IO operations (connect, read, etc.) cannot be interrupted on Windows. Additionally, threadWaitRead and threadWaitWrite do not work on Windows (IIRC, they can't tell if the given file descriptor is a socket or not, so they assume it's not).
The reason is that GHC does not have an IO manager for Windows like it does for *nix. For Windows with -threaded, the network package uses blocking FFI calls, which cannot be interrupted by asynchronous exceptions. Thus, System.Timeout and killThread can't be used to time out and interrupt network IO.
I'm working on a program that needs to run on a Windows XP machine for long periods of time, interacting with a couple intermittent network services. This issue is making things very difficult for me, so I want to get it fixed. I do not need to support thousands of concurrent connections efficiently; I just need my program to run reliably.
What needs to happen for IO to be interruptible on Windows with -threaded ? I'm willing to put in the work, but there's a lot I'd have to learn about windows IO and GHC IO handling. One question to get started: are threadWaitRead/threadWaitWrite even possible to implement on Windows, or might Windows assign overlapping HANDLE numbers to sockets and regular files?
This issue spans both GHC and the network package, but I'd like to collect information about it in one place. Related issues:
Change History (37)
comment:1 Changed 4 years ago by
|Component:||Runtime System → libraries/base|
Changed 4 years ago by