From engr@wiggum.com Thu Aug  5 15:00:56 1999
Return-Path: <engr@wiggum.com>
Received: from wiggum.com (ip31.sb.net [209.241.234.31])
	by hub.freebsd.org (Postfix) with ESMTP id 231881558D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  5 Aug 1999 15:00:55 -0700 (PDT)
	(envelope-from engr@wiggum.com)
Received: (from engr@localhost)
	by wiggum.com (8.9.2/8.9.2) id OAA89298;
	Thu, 5 Aug 1999 14:59:46 -0700 (PDT)
	(envelope-from engr)
Message-Id: <199908052159.OAA89298@wiggum.com>
Date: Thu, 5 Aug 1999 14:59:46 -0700 (PDT)
From: xshen@sb.net
Sender: engr@wiggum.com
Reply-To: xshen@sb.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: System queue UNIX domain socket. 
X-Send-Pr-Version: 3.2

>Number:         12991
>Category:       kern
>Synopsis:       system queue is cleared when a port or pipe is rebinded to another user processor.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug  5 15:10:00 PDT 1999
>Closed-Date:    Fri Jul 20 17:06:14 PDT 2001
>Last-Modified:  Fri Jul 20 17:07:19 PDT 2001
>Originator:     Xiaodong Shen
>Release:        FreeBSD 3.1-RELEASE i386
>Organization:
>Environment:

Noraml environment.
	

>Description:
* run a small server-client program based on UNIX Domain Socket on FreeBSD;
* server close the listen socket after the completion of one connection;
* client forks several children to connect to the server concurrently;
* Not all the clients' connections will be handled by the server because the closing listening socket causes kernel clear the system queue and all other requests in it.
* run the same program on Linux and Solaris the contents of the system queue can be preserved for a while, and the system queue has nothing to do with close() by user processes.
* If I want to keep the contents of the queue on FreeBSD, what should I do?
	

>How-To-Repeat:
Server:
char LINK_FILE[]="foo";
int listen_socket, conn_socket, clilen;
fd_set rset;
sockaddr_un addr1, addr2;
for(;;){
   unlink(LINK_FILE);
   listen_socket = socket(AF_UNIX, SOCK_STREAM, 0);
   bzero(&addr1, sizeof(addr1));
   addr1.sun_family = AF_UNIX;
   strncpy(addr1.sun_path, LINK_FILE, sizeof(addr1.sun_path)-1);
   bind(listen_socket, (struct sockaddr *)&addr1, SUN_LEN(&addr1));
   FD_ZERO(&rset);
   listen(listen_socket, 5);
   FD_SET(listen_socket, &rset);
   if((nready=select(listen_socket+1,&rset,NULL,NULL,NULL))>0){ 
      if(FD_ISSET(listen_socket, &rset)){
         clilen = sizeof(addr2);
         conn_socket=accept(listen_socket,(struct sockaddr *)&addr2,&clilen);
         read(conn_socket, pin, 1024); 
         write(conn_socket, pout, 1024); 
         close(conn_socket);
         close(listen_socket);
      }
   }
}

client:
int total, child, sock;
for(total=0; total<child; total++){
   if(!fork()){
      sock = open_socket(total);
      write(sock, pout, 1024);
      read(sock, pin, 1024);
      close(sock);
   } 
}
do{
   wait(&status);
   k++;
}while(k<child);
              
	

>Fix:
Not available yet.

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Sun Aug 22 13:45:05 PDT 1999 
Responsible-Changed-Why:  
Misfiled PR 
State-Changed-From-To: open->closed 
State-Changed-By: mike 
State-Changed-When: Fri Jul 20 17:06:14 PDT 2001 
State-Changed-Why:  

This is a question, not a problem report. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12991 
>Unformatted:
