Problem with fclose() returning error (EBADF)

Doug White dwhite at gumbysoft.com
Wed Sep 22 19:14:18 PDT 2004


On Wed, 22 Sep 2004, Robert Blayzor wrote:

> I have a multithreaded application running on FreeBSD 4.9, .10 and
> -STABLE that I'm having an issue with.
>
> The application writes large amounts of small files over an NFS mount
> and randomly we're seeing fclose() return a failure code, -1 and
> errorno, EBADF.
>
> We have no idea what may be causing the problem.  The NFS server appears
>   to be functioning fine, no errors at all, it runs perfectly over tons
> of other clients.

Ethereal is really nice for doing NFS protocol traces.  If you can
reproduce it and run ethereal (or tcpdump writing to a file) on the the
output, and filter down to the transaction stream you're interested in.

See if you can make a test app that implmenets the minumum functionality
required to reproduce the problem.

EBADF sounds more like a program bug, though ... file descriptor getting
closed by one thread and not accounting for it, or a race, or data
corruption...

-- 
Doug White                    |  FreeBSD: The Power to Serve
dwhite at gumbysoft.com          |  www.FreeBSD.org


More information about the freebsd-stable mailing list