From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86615 invoked by alias); 24 May 2016 10:23:07 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 86508 invoked by uid 89); 24 May 2016 10:23:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-96.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=incurred, Kevin, occasionally, hangs X-HELO: calimero.vinschen.de Received: from ipbcc04766.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.71.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 May 2016 10:21:06 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 298AFA8084C; Tue, 24 May 2016 12:20:57 +0200 (CEST) Date: Tue, 24 May 2016 10:23:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: spinlock.h timeout causing *** fatal error - add_item abort Message-ID: <20160524102057.GB32753@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rS8CxjVDS/+yyDmU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-SW-Source: 2016-05/txt/msg00278.txt.bz2 --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2046 On Apr 29 16:03, Kevin Nomura wrote: > Hi, >=20 > We occasionally see an api_fatal abort during process startup like: >=20 > *** fatal error - add_item ("somepath", "/", ...) failed, errno 1 >=20 > This happens if mountinfo.init(false) in user_info::initialize is > called twice. The error occurs on a second call when trying to add > the root mount point when it already exists. >=20 > mountinfo.init is guarded by a "spinlock" object that should only > allow one process to call it. But the spinlock has a timeout. After > 15 seconds, it stops waiting and returns a value of 0. The fatal > error can occur if two processes are starting around the same time > and the first process takes a long time in internal_getpwsid(). We've > seen this happen in our environment due to LDAP queries taking a long > time. (Incidentally we are using msys, but code in spinlock.h and > shared.cc looks the same in cygwin). >=20 > To solve the aborts it is tempting to make a local fix to remove the > spinlock timeout. I assume there was a rationale for it, and would > like to understand what tradeoff is incurred if we remove it. Actually I can't tell you. You might just want to try it and see if it has some weird side-effect. The problem this *probably* was supposed to handle is that some process hangs in the initialization indefinitely, thus blocking out other processes. 15 secs is just some arbitrary big value. The original reason to use a spinlock here wasbased on the idea that reading fstabs and passwd/group files is quick, thus a spinlock is the least intrusive locking mechanism. This is obviously not true anymore, now that fetching the user info may require network access. I put an item on my TODO list to revisit this code and introduce another, more reliable locking here. For the time being you might want to try a spinlock with a longer timeout (2 mins, perhaps) Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --rS8CxjVDS/+yyDmU Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXRCsJAAoJEPU2Bp2uRE+giWkP/RYTMKlUqddhS3+5YfDC/cxQ dG8dhkoD5+iVcDY1Io8DgQsr06MHcFoyKqSrONovbLO2QD/pZDbE5lBcxt5vBX6w qElBoepKiHGtntVrtaDa3InI2zD1Vae/4nka9pOKRIK1j3tVTHCIRaf6j2NRrfmU yBcn4nBe4En/swiLH1rD1cRVCq28wV3wyzj9ZJysnOpU6bFFEOXI1uzyjzFMo19e Fh/4C7n8doQHQ4irx9arhfzb7ifP5habeATDG5a8Img0bIshy7nvfUDK/uh3Eo1T 0XDm9x13hnJEX9HuNIbxVKtxVcxYXrlCVjHfu5nybNeO1eQw/6eXj+rrUw868et8 49pf5K+GOGk2pmU2ED3tqWwPeyJ4XCK5Nrf2LH+skE7VwU1pr3wFhPgaMfrevfIf VS9UlsxQE1BE7pKSFZuKDZr33Em6JYCvxoJMDuW3J0UoMmu8N32v7ut/DXLeKPUB IdAScnb1QdJc85vxHO/N6klY0/7fQOcvqpeylLORUV7ocXKUcYYoSyze4QBKnbWV pTA2ppiLlLpO18Epkm1YtAVFx+DBg+A8L9084fdKs3yGsRqt3VwYVzszPqTvBLpi 7vO+ebAqsrT18dv/MvQOckZhV64Z0RCLpQUjdXzJ27pVIFsZnhdIO8Bfq9zzfoza +vxqOT9P3YZMEDWbScfO =ZO/p -----END PGP SIGNATURE----- --rS8CxjVDS/+yyDmU--