delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/10/27/06:24:59

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Sat, 27 Oct 2012 12:24:28 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Possible race in SYSV IPC (semaphores)
Message-ID: <20121027102428.GA13293@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <A9D8BF3D8A74DF4A925FB541C0F39D2A17029755C5 AT NIHMLBX15 DOT nih DOT gov>
MIME-Version: 1.0
In-Reply-To: <A9D8BF3D8A74DF4A925FB541C0F39D2A17029755C5@NIHMLBX15.nih.gov>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Oct 26 14:36, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> Hi,
> 
> For now, I can only report the observed (mis) behavior of SYSV semop() call,
> which (on the client side) gets manifested as the following:
> 
> transport_layer_pipes::connect: lost connection to cygserver, error = 2
> 
> (this code then does a by-hand adjustment with semctl(SETVAL)).
> 
> Note that there is a dedicated cygserver process running for my single-threaded
> application.
> 
> Looking at the debugging output of cygserver, this is what I see in the log
> (around the only time semctl() is logged there):
> 
> cygserver: /home/corinna/src/cygwin/cygwin-1.7.15/cygwin-1.7.15-1/src/cygwin-1.7.15/winsup/cygserver/transport_pipes.cc, line 132: Try to create named pipe: \\.\pipe\cygwin-13a7ed34cc1953a9-lpc
> cygserver: /home/corinna/src/cygwin/cygwin-1.7.15/cygwin-1.7.15-1/src/cygwin-1.7.15/winsup/cygserver/transport_pipes.cc, line 132: Try to create named pipe: \\.\pipe\cygwin-13a7ed34cc1953a9-lpc
> 
> Note the double pipe creation call, and only a single "exit" log line such as:
> cygserver: /home/corinna/src/cygwin/cygwin-1.7.15/cygwin-1.7.15-1/src/cygwin-1.7.15/winsup/cygserver/sem.cc, line 81: leaving (3416)

That's normal, AFAICS.  Look into cygserver.cc, method
server_submission_loop::request_loop().  It calls _transport->accept()
in a loop.  _transport->accept always prints the "Try to create" log
message.  Every time a client connects, it will return, the cleint
request is put into the request queue, and then the loop returns to
call _transport->accept().  So you see this log message one more time
than clients have connected up to that point in time.

> Cygserver does not stop (also, since SIGSYS is set to ignore in the program,
> it also keeps running -- although, not always quite successfully once the semop()
> failure occurred.)
> 
> The semaphore operations are very intensive; and involve arrays of 5 sems at
> some times;  also, there are quite large chunks of shmem updated every now
> and then.
> 
> I studied the source of cygserver, and noticed that pipe_instance (transport_pipes.cc)
> is not declared "volatile".  This is strange because the compiler can rearrange lines
> of code that include this variable, otherwise.  And that seems rather critical.

You could build cygserver with the variable set to volatile and see if
it changes anything.  But I doubt it.

> Right now what I observe, is that SYSV IPC is unreliable, and I'm yet to figure
> out why;

For testing it would be most helpful if you would create a STC.  Ideally
it would be the shortest possible code which allows to reproduce the issue.

Other than that, is it possible that you just stumble over a restriction
in the sizes of the IPC objects?  Did you try to tweak /etc/cygserver.conf
for a start?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019