This is the mail archive of the 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]

Re: cygipc shmat bug


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

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

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,
Michael Haubenwallner
Forschung & Entwicklung
SALOMON Automation GmbH
A-8114 Friesach bei Graz

Unsubscribe info:
Bug reporting:

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