public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Ken Brown <kbrown@cornell.edu>
Cc: cygwin <cygwin@cygwin.com>
Subject: Re: Fork issue with timerfd
Date: Sun, 24 Feb 2019 19:01:00 -0000	[thread overview]
Message-ID: <20190224185524.GE4133@calimero.vinschen.de> (raw)
In-Reply-To: <ca9a38b7-c147-78a3-0660-70aa65b41eb3@cornell.edu>

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

On Feb 24 17:27, Ken Brown wrote:
> I'm seeing sporadic errors like this on 64-bit Cygwin when I first start emacs:
> 
>        0 [main] emacs-X11 864 C:\cygwin64\bin\emacs-X11.exe: *** fatal error in 
> forked process - Can't recreate shared timerfd section during fork!
>        0 [main] emacs 860 dofork: child 864 - died waiting for dll loading, errno 11
> 
> If I exit and restart, everything will be fine almost every time.

I think I see where the thinko was here.  Can you try this?

diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc
index 7e6be72b225a..7eda71ddb235 100644
--- a/winsup/cygwin/timerfd.cc
+++ b/winsup/cygwin/timerfd.cc
@@ -408,6 +408,7 @@ void
 timerfd_tracker::fixup_after_fork_exec (bool execing)
 {
   NTSTATUS status;
+  PVOID base_address = NULL;
   OBJECT_ATTRIBUTES attr;
   SIZE_T vsize = PAGE_SIZE;
 
@@ -416,11 +417,12 @@ timerfd_tracker::fixup_after_fork_exec (bool execing)
     return;
   /* Recreate shared section mapping */
   status = NtMapViewOfSection (tfd_shared_hdl, NtCurrentProcess (),
-			       (void **) &tfd_shared, 0, PAGE_SIZE, NULL,
+			       &base_address, 0, PAGE_SIZE, NULL,
 			       &vsize, ViewShare, MEM_TOP_DOWN, PAGE_READWRITE);
   if (!NT_SUCCESS (status))
-    api_fatal ("Can't recreate shared timerfd section during %s!",
-	       execing ? "execve" : "fork");
+    api_fatal ("Can't recreate shared timerfd section during %s, status %y!",
+	       execing ? "execve" : "fork", status);
+  tfd_shared = (timerfd_shared *) base_address;
   /* Increment global instance count by the number of instances in this
      process */
   InterlockedAdd (&tfd_shared->instance_count, local_instance_count);


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

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

  reply	other threads:[~2019-02-24 18:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 18:55 Ken Brown
2019-02-24 19:01 ` Corinna Vinschen [this message]
2019-02-24 19:53   ` Corinna Vinschen
2019-02-24 23:42     ` Corinna Vinschen
2019-02-25  3:21       ` Ken Brown
2019-02-25  7:10         ` Ken Brown
2019-02-25 10:51           ` Corinna Vinschen
2019-02-25 22:01             ` Corinna Vinschen
2019-02-26  3:12               ` Ken Brown
2019-02-26  9:01                 ` Corinna Vinschen
2019-02-26  9:37                   ` Corinna Vinschen
2019-02-26 11:46                   ` Corinna Vinschen
2019-02-26 15:05                     ` Ken Brown
2019-02-27 16:24                       ` Corinna Vinschen
2019-02-27 16:39                         ` Ken Brown
2019-02-27 19:31                           ` Corinna Vinschen
2019-03-04 18:13                           ` Achim Gratz
2019-03-04 21:46                             ` Ken Brown
2019-03-05 19:15                               ` Achim Gratz
2019-03-06 20:55 Peter Kozich (UM)
2019-03-06 21:23 ` Corinna Vinschen
2019-03-08 19:56   ` Peter Kozich (UM)
2019-03-08 20:10     ` Rockefeller, Harry
2019-03-08 20:22       ` Corinna Vinschen
2019-03-08 21:27         ` Rockefeller, Harry
2019-03-09 15:38           ` Corinna Vinschen
2019-03-08 22:04         ` Ken Brown
2019-03-09 12:35           ` Ken Brown
2019-03-09 15:38             ` Corinna Vinschen
2019-03-09 18:48               ` Ken Brown
2019-03-09 19:08                 ` Corinna Vinschen
2019-03-08 22:21   ` Peter Kozich (UM)
2019-03-08 22:44     ` Peter Kozich (UM)
2019-03-09 15:39       ` Corinna Vinschen
2019-03-11 18:25         ` Peter Kozich (UM)

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=20190224185524.GE4133@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=kbrown@cornell.edu \
    /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).