Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Mar 2011 14:43:42 GMT
From:      Heribert Steuer <steuer@unixsystems.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/155606: select() does not return EBADF on closed file descriptor
Message-ID:  <201103161443.p2GEhg3H005370@red.freebsd.org>
Resent-Message-ID: <201103161450.p2GEo86V013347@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103161443.p2GEhg3H005370>