Subject: bug#13527: 24.2.92; Spawning child process: resource temporarily unavailable

From: Eli Zaretskii <[email-masked]>
Date: Tue, 22 Jan 2013 17:39:56 +0200

> From: "Sebastien Vauban" <[email-masked]>
> Cc: Sebastien Vauban <[email-masked]>,  [email-masked]
> Date: Tue, 22 Jan 2013 16:21:54 +0100
> 
> > If you can run Emacs under GDB, I can tell you how to get the
> > information needed to understand this problem.
> 
> Do you mean: launching Emacs from within GDB?  Or simply being able to attach
> GDB to a running Emacs?  In the latter case, yes.

It doesn't matter, whatever is easier for you.

> So does the first case as well, apparently:
> 
> --8<---------------cut here---------------start------------->8---
> $ cd Program\ Files\ \(x86\)/emacs-24.2.92/bin
> $ gdb runemacs.exe

You need to use "gdb emacs.exe", runemacs.exe is just a launcher
program.

> So, yes, I'd be interested by how to study this...

The error message comes from this snippet in callproc.c:

  #ifdef WINDOWSNT
    prepare_standard_handles (in, out, err, handles);
    set_process_dir (SDATA (current_dir));
    /* Spawn the child.  (See ntproc.c:Spawnve).  */
    cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
    reset_standard_handles (in, out, err, handles);
    if (cpid == -1)
      /* An error occurred while trying to spawn the process.  */
      report_file_error ("Spawning child process", Qnil);
    return cpid;

  #else  /* not WINDOWSNT */

The call to 'spawnve' will end up in w32proc.c:sys_spawnve, which
returns EAGAIN here:

  cp = new_child ();
  if (cp == NULL)
    {
      errno = EAGAIN;
      return -1;
    }

Therefore, step into spawnve, then step into new_child, and see why
new_child returns NULL.  I see a couple of places where it does so,
one of them because there's already 32 subprocesses running (which is
a hard limit in Emacs on Windows), the other one because some system
APIs fail.

If you need more instructions about the specific GDB commands to use,
please don't hesitate to ask.

Thanks.