hIsEOF blocks when applied to a non-closed socket with no input available
As shown with the attached test-programs, hIsEOF will block when applied to a socket-handle that is not closed and has no input available.
I believe that hIsEOF blocks, as it calls hLookAhead (see libraries/base/GHC/Handle.hs), which blocks when there is no input. Note that this is only a problem when using sockets, as (local) files will either be EOF or has some content.
If hIsEOF blocking nature is expected behaviour, then I think it should be noted in the haddock-documentation, as it seems non-obvious. Especially, as it will seem non-blocking when working with files.
I am using GHC 6.8.2 on a Debian Linux box.
To reproduce the bug, then first compile the test programs using the accompanying makefile. Then start the server. After that the client. As can be seen, the server will hang.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Multiple |