[Haskell-cafe] network-conduit failing to close sockets

Ertugrul Söylemez es at ertes.de
Wed Feb 1 17:18:36 CET 2012

Hello there,

I have tried to implement a simple echo server using the network-conduit
library version 0.2.1.  This is the code:

    module Main where

    import Data.Conduit
    import Data.Conduit.Network

    main :: IO ()
    main = runTCPServer (ServerSettings 4000 Nothing) ($$)

It works, but at some point it dies with too many open files, even
though I never open two connections simultaneously:

    % ./echo-server
    echo-server: accept: resource exhausted (Too many open files)

Apparently it fails to close the sockets properly.  This is the client
side code I have used for testing in GHCi:

    > :m Network Control.Monad System.IO
    > replicateM_ 512 (connectTo "" (PortNumber 4000) >>=

I'm running the action once, then wait a few seconds to give the server
a chance to close the handles.  Then I run it again, causing the server
program to die with the above mentioned error message.

Am I doing something wrong or is this a bug in network-conduit?


nightmare = unsafePerformIO (getWrongWife >>= sex)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120201/d427e7e7/attachment.pgp>

More information about the Haskell-Cafe mailing list