X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Mon, 8 Mar 2010 14:56:57 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>,
   "Schmidt, Oliver" <oliv.schmidt@sap.com>
Subject: Re: Cygwin 1.7: Concurrency Issue with Shared State Initialization
Message-ID: <20100308195656.GA17237@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: "cygwin@cygwin.com" <cygwin@cygwin.com>, 	"Schmidt, Oliver" <oliv.schmidt@sap.com>
References: <B10B50309DC54D45A855FD66F56015F71D07C78CAE@DEWDFECCR03.wdf.sap.corp>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <B10B50309DC54D45A855FD66F56015F71D07C78CAE@DEWDFECCR03.wdf.sap.corp>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Mon, Mar 08, 2010 at 06:35:02PM +0100, Schmidt, Oliver wrote:
>We call from a non-Cygwin shell a non-Cygwin gnumake.  The Makefile
>rules mostly call a non-Cygwin C compiler and linker.  However Makefile
>rules calling gawk, cat, cp, echo, mkdir, rm, sed, sh, ...  are calling
>Cygwin executables.
>
>If (and only if) we run gnumake in this scenario with the --jobs option
>to perform a parallel build then we experience sporadic failures of the
>Cygwin executables.  Fortunately these failures still happen now and
>then when running them with strace.  So it was quite easy to find out
>that the shared variable installation_root isn't correctly initialized
>when things go wrong.
>
>Checking out src/winsup/cygwin/shared.cc I stumbled over these lines
>
>    /* Initialize installation root dir. */
>     if (!installation_root[0])
>       init_installation_root ();

Yeah, that's one place that's missing synchronization.

I'll check in something tonight which attempts to solve this problem.
It's a somewhat tricky problem because adding a mutex here would slow
down every invocation of a cygwin program and we don't want to add to
the "Why is Cygwin so slow???" scenarios if we can help it.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

