delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/31/08:28:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C59465A.65EBEF58@salomon.at>
Date: Thu, 31 Jan 2002 14:27:54 +0100
From: Michael Haubenwallner <michael DOT haubenwallner AT salomon DOT at>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i686)
X-Accept-Language: de-AT, en
MIME-Version: 1.0
To: Christophe LEITIENNE <cleitienne AT wanadoo DOT fr>
CC: cygwin AT cygwin DOT com
Subject: Re: cygipc shmat bug
References: <3C5937FE DOT C87567DD AT salomon DOT at>
X-Virus-Scanned: by AMaViS perl-11

Hi,

while i'm looking for new messages depending on cygipc,
found this and i am able to say:

Christophe LEITIENNE wrote:
> 
> Hi all,
> I've noticed some problems using shared memory with cygipc, which don't
> seem
> to be present in the mailing list archives.
> I'm running cygwin 1.3.9 with cygipc 1.11 on a W2K machine.

This is independent from cygwin-release, it is a cygipc-problem...

> SYMPTOMS
> If you run multiple times a simple app that attaches a shared memory
> segment
> (with shmat), some attachments fail (shmat return -1, errno: invalid
> argument).
> 
> TO REPRODUCE THIS BEHAVIOR:
> - open a cygwin bash shell
> - launch "ipctest.exe h" to create a shared memory segment
> - call "ipcs" to know the shmid of the segment you just created
> - then run "while true; do ipctest.exe h a <shmid>; done"
> You'll see that some of the attachments fail with "shmat : Invalid
> argument"

The 'real' problem is that ipctest.exe does shmat()
and then dies _without_ doing shmdt().

So the attach is not removed immediately from internal attach-list,
and the ipc-daemon has to test for the process and to remove the
attach if not found. This is done about every 3 seconds (and might
work better with http://cygwin.com/ml/cygwin/2002-01/msg01148.html).

The problem is, that the pid-numbering of Windows is quite "confuse"
(i don't know any better word), meaning that a later ipctest.exe
gets the same pid as before, while the attach before with the same
pid is not removed from the list yet.

So the test for 'already attached' is true and the return is EINVAL.

> Well, I'm not sure this is really a new bug, since I saw that shmat uses
> mmap and mmap is buggy, right ?
> 
> Best Regards,
> 
> Christophe LEITIENNE

Well, i do not have already a good fix for this, but if ipctest.exe
does a shmdt() before exiting, the problem does not appear any more.

so long,
   haubi
--
Michael Haubenwallner
Forschung & Entwicklung
SALOMON Automation GmbH
A-8114 Friesach bei Graz
mailto:michael DOT haubenwallner AT salomon DOT at
http://www.salomon.at

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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