From owner-freebsd-questions@FreeBSD.ORG Fri Apr 30 22:14:21 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 198161065670 for ; Fri, 30 Apr 2010 22:14:21 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id B6FB58FC14 for ; Fri, 30 Apr 2010 22:14:20 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o3UMEJh5071188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 30 Apr 2010 17:14:19 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.3) with ESMTP id o3UMEJUS051824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 30 Apr 2010 17:14:19 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o3UMEIXa051823; Fri, 30 Apr 2010 17:14:18 -0500 (CDT) (envelope-from dan) Date: Fri, 30 Apr 2010 17:14:18 -0500 From: Dan Nelson To: Joerg Bruehe Message-ID: <20100430221418.GJ14572@dan.emsphone.com> References: <4BD9D098.8010201@mysql.com> <20100429194932.GI14572@dan.emsphone.com> <4BDB49FF.4000303@mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BDB49FF.4000303@mysql.com> X-OS: FreeBSD 8.0-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Fri, 30 Apr 2010 17:14:20 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: FreeBSD-Questions Subject: Re: Need info about FreeBSD and interrupted system calls for MySQL code X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2010 22:14:21 -0000 In the last episode (Apr 30), Joerg Bruehe said: > Dan Nelson wrote: > > In the last episode (Apr 29), Joerg Bruehe said: > >> For some long, unknown time, the MySQL code contains a variable > >> "net_retry_count" which is by default set to 10 (ten) for all platforms, > >> but to 1000000 (1 million) for FreeBSD (during configure phase). > >> > >> The source code comment about this variable reads > >> If a read on a communication port is interrupted, retry this many > >> times before giving up. > >> > >> [[...]] > > > > I'm pretty sure this is a holdover from when FreeBSD only had a user > > pthreads package (libc_r). libc calls that would normally block got > > converted into non-blocking versions and a select() loop would execute > > threads as the events they were waiting on occurred. Incoming signals > > would cause all threads waiting on read() to return EINTR. If you have > > other threads doing work and sending/receiving signals, this can add up > > to a lot of extra EINTR's. > > Interesting information - thanks. I never heard that before, but it > explains a lot. This may also have been due to a bug in the early libc_r code. Appropriate use of sigwait() and pthread_sigmask() should let the pthreads library know which read() calls it can silently retry on behalf of threads that are ignoring signals (and thus shouldn't have their syscalls aborted with EINTR). I have email records talking about libc_r problems with signal masking from the FreeBSD 2.2.7 days (~1998). It's possible that later libc_r versions had fixed the bug. I used to have copies of the ancient mysql source code around (3.22 and 3.23 era), but have since deleted them, so I don't know when the 1000000 workaround was added. -- Dan Nelson dnelson@allantgroup.com