#2109: hIsEOF blocks when applied to a non-closed socket with no input available
--------------------------------------+-------------------------------------
Reporter: Mads | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 6.8.2 | Severity: normal
Keywords: hIsEOF blocks sockets | Testcase:
Architecture: Multiple | Os: Unknown
--------------------------------------+-------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2109>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs