This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin 1.7: Concurrency Issue with Shared State Initialization


Hi,

I think Cygwin 1.7 has a concurrency issue with the shared state initialization - which we experience because we use Cygwin in a probably untypical fashion:

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 ();

and thought that things might go wrong because several processes are calling into init_installation_root() at the same time and was wondering why there's no kind of locking in place. I don't want to claim that this is the very root cause of the issue. However I tried to keep a Cygwin shell open in another window while running gnumake in order to have a stable shared state present for all Cygwin executables. I can definitively confirm that this shell makes in our scenario the difference between sporadic failure and smooth operation of the Cygwin executables.

I'm sorry that I don't have a simple reproducible test case but I'm sure that there IS a problem in that area - and it seems quite reasonable because
a) the code in question is quite new
b) most Cygwin users/testers most probable have some Cygwin executable constantly running or
c) don't start Cygwin executables in parallel thousand of times

Thanks in advance for your consideration.

Regards, Oliver Schmidt



--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]