1.5.19: fork: resource temporarily unavailable

Igor Peshansky pechtcha@cs.nyu.edu
Fri Jan 20 23:24:00 GMT 2006


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;
      static char buf[4096];
      int w = geterrno_from_win_error();
      snprintf(buf, 4095, "pinfo failed: %d, %d", e, w);
//    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      error = buf;
      syscall_printf ("pinfo failed: %d, %E", e);
      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

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?
      |\      _,,,---,,_	    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"

More information about the Cygwin-developers mailing list