Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

select: Bad file descriptor

1 view
Skip to first unread message

Paul Mineiro

unread,
Sep 22, 2002, 10:32:34 PM9/22/02
to
hi. i'm trying to teach myself haskell so i decided to write a simple
webserver as a learning exercise, inspired by Simon Marlow's paper.

it works ok, except that sometimes i get

<snip>
select: Bad file descriptor
StaticHttpServer: fatal error: select failed
</snip>

i can't seem to catch this exception (is it an exception?).

so, does anybody know what this is and whether it can be dealt with
gracefully? right now, it crashes the server.

i suppose i should provide some info about the system ... i'm running
debian woody with package ghc5-5.02.2-1.

if you'd like to see the source code, let me know. i'll make an
attempt to highlight the main loop, which is essentially:

acceptingLoop :: TcpServer -> MVar () -> (Exception -> IO Bool) -> IO
()
acceptingLoop s@(TcpServer sock _) mvar handleException =
do
catch (acceptingLoopSafe s)
(\e -> do
res <- handleException e
if res
then
acceptingLoop s mvar handleException
else
do
sClose sock
putMVar mvar ())


and the handleException i'm using now just logs to stderr and returns
true.

any help would be greatly appreciated,

-- p

Paul Mineiro

unread,
Sep 23, 2002, 12:07:19 PM9/23/02
to
paul-...@mineiro.com (Paul Mineiro) wrote in message news:<28f40664.02092...@posting.google.com>...

> <snip>
> select: Bad file descriptor
> StaticHttpServer: fatal error: select failed
> </snip>

duh, i should have indicated that i'm not using the haskell select
call. rather i'm using concurrent haskell, so this select is
occurring "under the hood".

again, any help would be greatly appreciated,

-- p

0 new messages