This is the mail archive of the
mailing list for the Cygwin project.
Re: cygipc shmat bug
- From: Michael Haubenwallner <michael dot haubenwallner at salomon dot at>
- To: Christophe LEITIENNE <cleitienne at wanadoo dot fr>
- Cc: cygwin at cygwin dot com
- Date: Thu, 31 Jan 2002 14:27:54 +0100
- Subject: Re: cygipc shmat bug
- References: <3C5937FE.C87567DD@salomon.at>
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
> 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...
> If you run multiple times a simple app that attaches a shared memory
> (with shmat), some attachments fail (shmat return -1, errno: invalid
> 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
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.
Forschung & Entwicklung
SALOMON Automation GmbH
A-8114 Friesach bei Graz
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html