From owner-freebsd-current Thu Sep 10 10:37:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA12386 for freebsd-current-outgoing; Thu, 10 Sep 1998 10:37:51 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from highwind.com (hurricane.highwind.com [209.61.45.50]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA12380 for ; Thu, 10 Sep 1998 10:37:44 -0700 (PDT) (envelope-from info@highwind.com) Received: (from info@localhost) by highwind.com (8.8.6/8.8.6) id NAA17787; Thu, 10 Sep 1998 13:37:21 -0400 (EDT) Date: Thu, 10 Sep 1998 13:37:21 -0400 (EDT) Message-Id: <199809101737.NAA17787@highwind.com> From: HighWind Software Information To: eischen@vigrid.com CC: freebsd-current@FreeBSD.ORG, tlambert@primenet.com, eischen@vigrid.com In-reply-to: <35F80435.41C67EA6@vigrid.com> (eischen@vigrid.com) Subject: Re: Thread Problems 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. -Rob To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message