From nobody@FreeBSD.org  Sun Oct  7 05:15:22 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id E9F8037B406
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  7 Oct 2001 05:15:21 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f97CFLC25200;
	Sun, 7 Oct 2001 05:15:21 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200110071215.f97CFLC25200@freefall.freebsd.org>
Date: Sun, 7 Oct 2001 05:15:21 -0700 (PDT)
From: liang weiya <liangvy@bigfoot.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: main thread will accept() failure when son thread and main thread accept() at the same time
X-Send-Pr-Version: www-1.0

>Number:         31097
>Category:       misc
>Synopsis:       main thread will accept() failure when son thread and main thread accept() at the same time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 07 05:20:01 PDT 2001
>Closed-Date:    Sat Jul 12 16:15:56 PDT 2003
>Last-Modified:  Sat Jul 12 16:15:56 PDT 2003
>Originator:     liang weiya
>Release:        4.1.1-Release
>Organization:
>Environment:
>Description:
when main thread and son threads call accept() after bind() at the same
time , main thread's accept() will return -1 yet son threads's return 
value is ok.
(env: g++ 2.95, pthread ,all are origin installed version)
same programs tested in redhat linux 7.1 and aix4.3 , and all return 
correct value after accept().
>How-To-Repeat:
example:
void (*fun)(..) ;
main(){
 ...
 int s = socket (...) ; 
 bind(...) ;
 pthread_create(fun,...) ;
 int v = accept(s,....) ; // here will always return -1 . 
 ...
}

void* fun(s){
 ...
 int sv = accept(s,...) ;  // return ok
 ...
}
>Fix:
this is used for thread pool server mode . don't let main() call accept() when thread pool call accept() .
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Dec 1 10:55:06 PST 2002 
State-Changed-Why:  

Is this bug still present in more recent releases? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31097 
State-Changed-From-To: feedback->closed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 16:15:48 PDT 2003 
State-Changed-Why:  
Feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31097 
>Unformatted:
