misc/155606: select() does not return EBADF on closed file descriptor

Heribert Steuer steuer at unixsystems.de
Wed Mar 16 14:50:08 UTC 2011


>Number:         155606
>Category:       misc
>Synopsis:       select() does not return EBADF on closed file descriptor
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 16 14:50:08 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Heribert Steuer
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD opusv2p.lr.invalid 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010     root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
I have tracked down a problem that came up while using the quickfix C++ library
on a FreeBSD 8.1 server.

We found that the select() system call does not return with a value < 0 and errno
set when called on a closed socket. This seems to be related to a threaded environment. Our logs stated, that this happens, whenever a thread context switch
occurs between the close() and the select() system calls.

If there is no context switch in between, select() returns -1 and errno is set 
to 9. This is the expected behaviour.

The process is reproducable. Unfortunately I cannot provide example code to reproduce this scenario.
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list