This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
1.5.19: fork: resource temporarily unavailable
- From: Igor Peshansky <pechtcha at cs dot nyu dot edu>
- To: cygwin-developers at cygwin dot com
- Date: Fri, 20 Jan 2006 18:24:40 -0500 (EST)
- Subject: 1.5.19: fork: resource temporarily unavailable
- Reply-to: cygwin-developers at cygwin dot com
Hi,
First reported in <http://cygwin.com/ml/cygwin/2005-12/msg00817.html>.
Here's a short summary: fork failes because pinfo doesn't initialize,
pinfo reports a loop because PID_EXITED is set. Still getting this with
the latest CVS build.
I'm still trying to debug this. I've inserted some code to get more
debugging information in frok::parent():
----
child.init (child_pid, 1, NULL);
if (!child)
{
int e = get_errno();
this_errno = get_errno () == ENOMEM ? ENOMEM : EAGAIN;
#ifdef DEBUGGING
static char buf[4096];
int w = geterrno_from_win_error();
snprintf(buf, 4095, "pinfo failed: %d, %d", e, w);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error = buf;
#else
syscall_printf ("pinfo failed: %d, %E", e);
#endif
goto cleanup;
}
----
And here's what it prints:
35096870 [main] bash 8760 fork: child 10096 - pinfo failed: 9, 17, errno 11
bash: fork: Resource temporarily unavailable
...
1993297946 [main] bash 8276 fork: child 10096 - pinfo failed: 0, 17, errno 11
bash: fork: Resource temporarily unavailable
Note that errno in the first case is EBADF (translated from
ERROR_INVALID_HANDLE, presumably), and in the second case it's NOERROR
(surprisingly). The translated Windows error in both cases is EEXIST (so
it's either ERROR_ALREADY_EXISTS or ERROR_FILE_EXISTS).
Looking at pinfo.cc, I suspect the errno is bogus, since if pinfo::init
gets to print "looping because ... PID_EXITED", no errors have occurred in
either mapping the shared region or accessing the procinfo data.
My earlier theory about pid reuse (one possible reason for the overlap in
the procinfo data) doesn't seem to be confirmed by the fact that I get the
error even with NPIDS_HELD doubled (to 8). Perhaps I should increase it
even more?
I would like to figure out what's causing this. My main question is: am I
on the right track here? What else should I look for?
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!)
|,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"