reading/writing blocking FDs over FD_SETSIZE is broken
GHC.IO.FD when reading from or writing to a blocking FD we first check (using our C function
fdReady) whether the underlying fd is ready for read/write, in an attempt to avoid blocking the current OS thread. On POSIX this check is done using select, with no test for whether the fd exceeds
FD_SETSIZE, causing a write out of bounds and various bad consequences.
readRawBufferPtr checks the error status of
writeRawBufferPtrNoBlock do not, making this issue harder to diagnose.
I suggest that
poll(2) where available. I can prepare a set of patches if needed.