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]

Need tech info on need_invisible() and CreateWindowStation


Hi,
first, let me introduce why I need technical infos on the need_invisible() stored in fhandler_console.cc. We have a Win32 tool (not cygwin) at the root starting (spawning) lot of cygwin programs at the same time for performing multiple processing at the same time so :
Win32 root program forking for example 10 threads, each of these threads will spawn a CygWin process (bash, make, ect...) & sure, each of this cygwin process (like make) will start still sub cygwin process or Win32 child process.

We sometimes randomly (but frequently) encountered lot of hangs (0%cpu) or loops not ending (25%cpu for example) in CygWin tools (bash, egrep, ...).
All other non cygwin programs (for example we use a gnu makefile spawning some Microsoft Visual Studio devenv.exe instances) never failed & work correctly. But as I said, sometiles cygwin processes hang.
We don't have any issue in a mono processing system with one child process tree. We tried with the last version of cygwin but it did not resolve our issues.

Looking into the gmame cygwin forum, I found lot of information reporting that these cygwin issues could be generated by a uncorrect SharedSection. We already increased the non interactive SharedSection value as we use non interactive to run our system, & sure, it resolve lot of hangs in non CygWin programs but CygWin still continues to hang as described above.

Investigating on my issue, I tried before disturbing you to take myself a look in the CygWin code. & then I saw that Cygwin calls itself a CreateWindowStation in fhandler_console.cc to allocate also a non interactive console for unused tty (if I understood correctly). So I have lot of concerns on this, so, lot of questions...

My first question, is can you explain exactly me regarding the code when/in which condition exactly with an example (bash calling make & for example make calling sh as sub process), when this code is called ? I did not exactly understand when ?

How is shared this Window station between all cygwin programs ?
I saw that you call the GetProcessWindowStation & GetUserObjectInformation & finally check the WSF_VISIBLE flag to see if you need to create one CygWinInvisible non interactive window station & at the end a default non interactive desktop. So, If running multiples instances of cygwin programs even if these instances are not some child instances of others cygwin programs, they will be attached to the already existing CygWinInvisible window station. But.... My concern here is when you have multiple isntances of cygwin program started in parallel for multi processing tools for example... Can these instances meet a race/concurrent/conflict access to this part of code & detecting together that there is no cygwininvisible winstation created & so calling together CreateWindowStation (or there are maybe somewere above int he code/call stack some semaphore managed not for encountering a race condition in this code ?) ?

Also, looking into the Cygwin code, there is no cygwininvisible winstation created (check on check the WSF_VISIBLE ) when it is already started from a non interactive desktop like a service (with the interact with desktop nt service checkbox unchecked), & so the cygwin process uses the winstation where it is running, am i right ?

If cygwin programs run under an interactive winstation & this code is so called, all cygwin programs running in this winstation will be automatically attached to the cygwininvisible winstation...
In this case, if having in an interactive session, lot of cygwin process, they will fill the cygwininvisible & could overflow/saturate it ?
So, I think a similar issue could no appears in my environment as cygwin already run under an invisible winstation... ? 
Why these two last questions ? because as we run lot & lot of child programs, our parent/root win32 program automatically create an invisibile winstation+its desktop for attaching each child process tree. in this manner of managing windows limitation, we have to find the correct sharedsection value for allowing all child programs tree to run+creating a specific number of winstation+desktop (for example ten winstation+its desktop & one child process tree under its of these). that's the only way (from my point of view;) )actually as workaround to manage the computer load under win32 :(

I know that you will redirect me to the "how to report a cygwin problem" document but these questions are to increase my knowledges & so if needed, to report my future requests with the best details ;)
Also, as running strace to find exactly where cygwin process lock/hang on our architecture is really complex, this why I also investigating on this way.

I also saw that (If i looked in the correct version), that Cygwin allocate at the end of the dll segment a block of memory for exchanging data with the child cygwin programs & that sometimes (if i understoound everything) due to dlls reallocation, this shared segment could be not allocated correctly... can this generate hanging/locking process ?

Just a last question (I know that my mail is already big), but Why sometime, cygwin also try to impersonate child processes ?

Thank's very a lot for your contributions ;) This will really help me to troubleshoot my issue in our system/configuration if not linked & due by cygwin ;)
Louis

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


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