Cygwin 1.7: Concurrency Issue with Shared State Initialization

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Mon Mar 8 20:50:00 GMT 2010


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



More information about the Cygwin mailing list