From owner-freebsd-current Thu Sep 10 11:19:54 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA22727 for freebsd-current-outgoing; Thu, 10 Sep 1998 11:19:54 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from plunger.gdeb.com (plunger.gdeb.com [153.11.11.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA22713 for ; Thu, 10 Sep 1998 11:19:41 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from clcrtr.clc.gdeb.com ([153.11.109.11]) by plunger.gdeb.com with ESMTP (1.37.109.16/CSC-E_1.8) id AA202861504; Thu, 10 Sep 1998 14:18:24 -0400 Received: from clcrtr.clc.gdeb.com (clcrtr [153.11.109.129]) by clcrtr.clc.gdeb.com (8.8.8/8.7.3) with SMTP id OAA09269; Thu, 10 Sep 1998 14:15:58 -0400 (EDT) Message-Id: <35F8175E.167EB0E7@vigrid.com> Date: Thu, 10 Sep 1998 14:15:58 -0400 From: "Daniel M. Eischen" X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2.6-STABLE i386) Mime-Version: 1.0 To: info@highwind.com Cc: eischen@vigrid.com, freebsd-current@FreeBSD.ORG, tlambert@primenet.com Subject: Re: Thread Problems Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > It looks like the problem lies in the threads implementation > of fork and execve. When you fork, the child process gets a > copy of the parents file descriptors, which includes the listen > socket. When you exec, the threads library goes through its > list of file descriptors and returns their mode to non-blocking > (unless the application explicitly sets the mode to non-blocking). > > Yep. That is what is happening. > > It seems to me that someplace (perhaps on the fork() or exec() or > pthread man page), this should be noted. > > This is a serious problem and is hard to know about. > > > A simple solution that you can make in your application, is to close > > all relevent sockets after the fork and before the execl. > > Seems to me that this is the only really workable solution. > > Is there a way to get "the highest numbered socket in use"? > That would make the task easy. Just loop 0 to that number and test > against the few sockets you need open. Not that I know of. Does the program being forkExec'd need to access sockets? Dan Eischen eischen@vigrid.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message