From owner-freebsd-questions@FreeBSD.ORG Fri Apr 30 21:22:27 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 81CBB1065673 for ; Fri, 30 Apr 2010 21:22:27 +0000 (UTC) (envelope-from joerg@mysql.com) Received: from gmp-eb-inf-1.sun.com (gmp-eb-inf-1.sun.com [192.18.6.21]) by mx1.freebsd.org (Postfix) with ESMTP id 14C108FC15 for ; Fri, 30 Apr 2010 21:22:26 +0000 (UTC) Received: from fe-emea-09.sun.com (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged)) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o3ULMPU4026778 for ; Fri, 30 Apr 2010 21:22:26 GMT MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-15 Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0L1P00F00KINSW00@fe-emea-09.sun.com> for freebsd-questions@freebsd.org; Fri, 30 Apr 2010 22:22:10 +0100 (BST) Received: from [129.150.118.126] ([unknown] [129.150.118.126]) by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0L1P005WBKOW4P20@fe-emea-09.sun.com>; Fri, 30 Apr 2010 22:22:09 +0100 (BST) Date: Fri, 30 Apr 2010 23:22:07 +0200 From: Joerg Bruehe In-reply-to: <20100429194932.GI14572@dan.emsphone.com> Sender: Joerg.Bruehe@Sun.COM To: Dan Nelson Message-id: <4BDB49FF.4000303@mysql.com> Content-transfer-encoding: QUOTED-PRINTABLE References: <4BD9D098.8010201@mysql.com> <20100429194932.GI14572@dan.emsphone.com> User-Agent: Thunderbird 2.0.0.23 (X11/20090817) 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 21:22:27 -0000 Dan, thanks for your reply: 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 plat= forms, >> 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 thi= s many >> times before giving up. >> >> [[...]] >=20 > I'm pretty sure this is a holdover from when FreeBSD only had a use= r > pthreads package (libc_r). libc calls that would normally block go= t > converted into non-blocking versions and a select() loop would exec= ute > threads as the events they were waiting on occurred. Incoming sign= als would > cause all threads waiting on read() to return EINTR. If you have o= ther > threads doing work and sending/receiving signals, this can add up t= o a lot > of extra EINTR's. Interesting information - thanks. I never heard that before, but it explains a lot. >=20 > FreeBSD 5.0 (released in 2003) was the first version to have kernel= -based > pthread support, so the original reason for raising net_retry_count= has long > since disappeared. It is quite possible that nobody checked this: "If it ain't broken ..." >=20 > A related question might be, though: Should that variable even exi= st?=20 > EINTR isn't technically a failure, and most programs that read from= sockets > simply wrap their read()s in a loop that retries when EINTR is rece= ived.=20 > Only mysql actually counts the number of times through the loop. I know and agree that EINTR is no failure if a system call takes long= , like read() or write() from/to a socket (or other slow device) on sufficiently large data. But my current action is not to change the code, rather it is a clean= up in the build system (you may have heard we are changing from the autotools to cmake), so currently I won't change that loop dealing wi= th possible system call interruptions (by not counting). So you are saying it might all be obsolete, and current versions of FreeBSD don't need this special setting. This sounds like I should do a build without it and then run tests. T= hanks! Regards, J=F6rg --=20 Joerg Bruehe, MySQL Build Team, Joerg.Bruehe@Sun.COM Sun Microsystems GmbH, Komturstrasse 18a, D-12099 Berlin Geschaeftsfuehrer: Juergen Kunz Amtsgericht Muenchen: HRB161028