This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Try to remove possible race pinfo::init
- From: Arto Huusko <arto dot huusko at wmdata dot fi>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 29 Jul 2005 13:39:14 +0300
- Subject: Try to remove possible race pinfo::init
On some systems, I was frequent segmentation faults on fork(), and
I was able to track it down to the patch I just sent. However, my
scripts don't run much better, because they now fail only a bit
more cleanly with "fork: Resource temporarily unavailable".
Since my previous patch transformed seg faults to EAGAIN errors,
I tried to find potential races or other errors in pinfo::init.
I didn't really take the time to try to understand the code, but
if I'm guessing right, the MapViewOfFileEx() call is doing something
that depends on the child. If that's right, then it seems to me
that the retry loop in open_shared() failure case is a bit too
tight.
2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
* pinfo.cc (pinfo::init): Sleep before retrying open_shared().
--- pinfo.cc 2005-07-29 11:25:43.501687460 +0300
+++ pinfo.cc.fixed 2005-07-29 11:26:17.931478519 +0300
@@ -235,6 +235,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE
}
debug_printf ("MapViewOfFileEx h0 %p, i %d failed, %E", h0, i);
+ low_priority_sleep (0);
continue;
}