From owner-freebsd-threads@FreeBSD.ORG Sun Aug 15 21:12:27 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0CE8C16A4CE; Sun, 15 Aug 2004 21:12:27 +0000 (GMT) Received: from blake.polstra.com (blake.polstra.com [64.81.189.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id A189F43D1D; Sun, 15 Aug 2004 21:12:26 +0000 (GMT) (envelope-from jdp@polstra.com) Received: from strings.polstra.com (dsl081-189-067.sea1.dsl.speakeasy.net [64.81.189.67]) by blake.polstra.com (8.12.11/8.12.11) with ESMTP id i7FLCQZp068615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Aug 2004 14:12:26 -0700 (PDT) (envelope-from jdp@strings.polstra.com) Received: (from jdp@localhost) by strings.polstra.com (8.12.11/8.12.11/Submit) id i7FLCQwg013721; Sun, 15 Aug 2004 14:12:26 -0700 (PDT) (envelope-from jdp) Message-ID: X-Mailer: XFMail 1.5.5 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Sun, 15 Aug 2004 14:12:25 -0700 (PDT) From: John Polstra To: Robert Watson X-Bogosity: No, tests=bogofilter, spamicity=0.047737, version=0.14.5 cc: threads@freebsd.org cc: mbr@freebsd.org Subject: RE: thread-unsafe syslog code in libc? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2004 21:12:27 -0000 On 15-Aug-2004 Robert Watson wrote: > On Sun, 15 Aug 2004, John Polstra wrote: > >> The above is only to handle an unusual error case. >> >> There is some thread-unsafeness here, but it doesn't look like it would >> matter under normal conditions. > > So maybe we're dealing with a user space race where multiple threads > attempt to do a first syslog in parallel? Probably not that. You said it was a simultaneous connect() and close(), right? The close is only done in disconnectlog() and closelog(). The former is only called in unusual error cases, and the latter is called by applications. So I guess one culprit could be a first syslog call in one thread and a closelog call in another thread. Or, maybe the system ran out of mbufs and the send() did fail, causing disconnectlog to be used and exercising the race. An out of mbufs condition might also contribute to the kernel panic you mentioned. John