I have a program that is suffering a select() failure.  It prints:

9
select: Bad file descriptor
Fed: fatal error: select failed

>From looking at some RTS sources, the 9 apparently represents errno EBADF 
(bad file descriptor).  Does that mean that my program is somehow closing
one or more file descriptors between when the select() starts and when it
finishes?  I need to spend more time debugging my program, but I thought
I'd just ask if anyone had any ideas relative to select().  

Unfortunately, select() (and hence the GHC RTS) doesn't identify the bad
descriptor(s).  Here's where I suspect my program may be going awry.  The
main process creates a pipe.  The process then forks.  The parent closes
the pipe's read descriptor immediately.  The child soon goes to read from
the pipe, using threadWaitRead followed by fdRead.  The child process
suffers the select failure shown above.

I'm running GHC 5.02.3 on Red Hat Linux; uname -a gives:
Linux sediment 2.4.2-2smp #1 SMP Sun Apr 8 20:21:34 EDT 2001 i686 unknown
and ghc -v starts off with:
Glasgow Haskell Compiler, Version 5.03.20020410, for Haskell 98, compiled
by GHC version 5.03.20020410

It appears there have been some recent changes involving use of select()
in the RTS.  Would upgrading to 5.04 be likely to help?

By the way, why shouldn't such a "fatal error" in the RTS raise an
exception that I can catch in my program?  I could then determine at least 
which thread in which process suffered the error.

Dean

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to