Skip to content

hWaitForInput with socket as handle excepts on windows

If I create a socket wrapped in a Handle (either by directly creating a handle with connectTo, or by creating a socket and wrapping it), hWaitForInput and hReady always give an exception with that handle. It excepts directly when calling, it does not wait until the given timeout of hWaitForInput has expired.

The following code exposes the bug (requiring that a server-socket is listening on port 7892):

module SockDebug
where
import System.IO
import Network

main = do
 sock <- connectTo "localhost" (Service $ show 7892)
 hWaitForInput sock 5000

Excepts with "hWaitForInput: invalid argument (Invalid argument)"

Happens both on windows 10 and windows 7.

This is the same error as in ticket 1198 so I'd guess that the bug is in cbits/inputReady.c as well, but I'm not an expert.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information