[PATCH RFC] fork: remove cygpid.N sharedmem on fork failure

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jun 21 07:28:00 GMT 2018


On Jun 20 17:47, Michael Haubenwallner wrote:
> On 06/07/2018 10:19 AM, Corinna Vinschen wrote:
> > On Jun  5 15:05, Michael Haubenwallner wrote:
> >> Hi,
> >>
> >> I'm using attached patch for a while now, and orphan cygpid.N shared memory
> >> instances are gone for otherwise completely unknown windows process ids.
> >>
> >> However, I do see defunct processes now which's PPID does not exist (any more),
> >> causing the same trouble because their windows process handle is closed but
> >> their cygpid.N shmem handle is not.
> >>
> 
> >>
> >> But I have no idea whether attached patch is causing or uncovering this issue...
> >>
> >> Any idea?
> > 
> > Not really.  Processes are kept around after exec to keep the PID
> > blocked.  Perhaps your patch is breaking an assumption there.
> > I wonder why you have a problem with failing forks in the first
> > place...?
> 
> I'm successfully using the topic/forkables patches still, where
> fork is retried using /var/run/cygfork/ when an exe or dll was
> replaced (by some in-cygwin package manager).
> 
> Without this patch, for the first-try child process which the
> cygwin1.dll fails to initialize for because of wrong dll loaded,
> the process handle is released but the cygpid.N shmem handle is not.
> 
> Then, another completely independent process may get the same
> windows process id again, and cygwin1.dll fails to initialize
> because of the existing but orphaned cygpid.N shmem handle.

This problem appear to be a non-problem in the normal code path.  In
case of restarting the 2nd-try child, wouldn't it make sense to reuse
the shmem area instead of breaking it down?

> For those "Suspended" windows processes (sh.exe):
> They seem to occur eventually when a shell script was executing some
> native windows process (msvc toolchain). Interesting here is that
> I got *4* Suspended sh.exe on the *4* core VirtualBox machine...

That really sounds weird.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20180621/62a6bcf6/attachment.sig>


More information about the Cygwin-patches mailing list