public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Cc: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST: Cygwin 3.0.0-0.3
Date: Tue, 05 Feb 2019 09:45:00 -0000	[thread overview]
Message-ID: <20190205094455.GQ3532@calimero.vinschen.de> (raw)
In-Reply-To: <40c1cbd8-be88-86d6-2b66-ded51129f2c3@ssi-schaefer.com>

[-- Attachment #1: Type: text/plain, Size: 2127 bytes --]

On Feb  5 09:42, Michael Haubenwallner wrote:
> On 2/4/19 3:25 PM, Corinna Vinschen wrote:
> > Are you going to test the patched branch?
> 
> Sorry, was indeed unclear: Yes, of course!
> Will start testing on Server 2012 while setting up a 2019 VM.
> 
> For now, there's already this one patch I've been using with good success,
> please add it to topic/forkables - the suspended thing is something different:
> https://cygwin.com/ml/cygwin-patches/2018-q2/msg00039.html

The collision problem shouldn't be as bad anymore with 3.0, given the
new PID handling.  However, after spending a bit more time in the fork
code, it looks like not releasing the procinfo in the error case is a
generic problem so I'm inclined to apply it to master.

While at it, there are quite a few spots in the code which end up
jumping to the cleanup code but only one of them calls TerminateProcess.
Wouldn't it make sense to move the TerminateProcess call into the
cleanup code to make sure the child process doesn't stay running
in some limbo state, not doing anything useful but not dying either?

Kind of like this:

diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 6f00364334c3..5f775249a990 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -400,7 +400,6 @@ frok::parent (volatile char * volatile stack_here)
      we can't actually record the pid in the internal table. */
   if (!child.remember (false))
     {
-      TerminateProcess (hchild, 1);
       this_errno = EAGAIN;
 #ifdef DEBUGGING0
       error ("child remember failed");
@@ -508,8 +507,12 @@ cleanup:
     __malloc_unlock ();
 
   /* Remember to de-allocate the fd table. */
-  if (hchild && !child.hProcess) /* no child.procinfo */
-    ForceCloseHandle1 (hchild, childhProc);
+  if (hchild)
+    {
+      TerminateProcess (hchild, 1);
+      if (!child.hProcess) /* no child.procinfo */
+	ForceCloseHandle1 (hchild, childhProc);
+    }
   if (forker_finished)
     ForceCloseHandle (forker_finished);
   debug_printf ("returning -1");


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-02-05  9:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 21:23 Corinna Vinschen
2019-01-31  8:47 ` Michael Haubenwallner
2019-01-31 19:48   ` Corinna Vinschen
2019-02-03 11:19     ` Corinna Vinschen
2019-02-04 13:20       ` Michael Haubenwallner
2019-02-04 14:25         ` Corinna Vinschen
2019-02-05  8:42           ` Michael Haubenwallner
2019-02-05  9:45             ` Corinna Vinschen [this message]
2019-02-05 11:31               ` Michael Haubenwallner
2019-02-05 11:57                 ` Corinna Vinschen
2019-02-06 14:28       ` Michael Haubenwallner
2019-02-06 16:20         ` Corinna Vinschen
2019-02-06 16:34           ` Corinna Vinschen
2019-02-07  7:07             ` Michael Haubenwallner
2019-02-06 19:20           ` Andrey Repin
2019-02-07  8:32             ` Michael Haubenwallner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190205094455.GQ3532@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=michael.haubenwallner@ssi-schaefer.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).