[GHC] #1114: Socket code dies with SIGPIPE
GHC
trac at galois.com
Mon Jan 22 21:21:51 EST 2007
#1114: Socket code dies with SIGPIPE
------------------------+---------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: hslibs/net | Version: 6.6
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86
Os: Linux |
------------------------+---------------------------------------------------
Comment (by guest):
Simpler self-contained test case.
{{{
#!hs
import Control.Concurrent
import System.IO
import Network
port = PortNumber $ fromIntegral 1234
main = withSocketsDo $
do sock <- listenOn port
forkIO $ connectTo "127.0.0.1" port >>= hClose
(h, _, _) <- accept sock
threadDelay 300000 -- ensure that close happens in connecting
thread
hPutChar h '1'
hFlush h -- two separate writes are needed
hPutChar h '2'
hClose h -- this actually does second flush and gets SIGPIPE
hPutStrLn stderr "OK?" -- we don't get here
}}}
{{{
#!text
select(0, [], [], NULL, {0, 0}) = 0 (Timeout)
gettimeofday({1169519318, 500011}, NULL) = 0
write(4, "1", 1) = 1
write(4, "2", 1) = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
+++ killed by SIGPIPE +++
Process 4072 detached
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1114>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list