The limit is 64 processes at which point a error code of 'Resource temporarily unavailable' is being generated somewhere. I think you found a bug in Perl.

What appears to be happening is that even though you are requesting an asynchronous process with the system 1, ...; call, and that is being honoured, Perl is still adding the process handle to it's array of things to wait for. But as this is an asynchronous process, it never is waited for and so the process handle is never subsequently removed. Once the 64 limit is reached, it refuses to attempt to start any more, (even if the processes have been terminated!), because it has no where to left to stash the handle

It basically a good old fashioned memory leak, and you should raise a Perlbug against it. You can reduce the demonstration code to

P:\test>perl -wle"system(1,'notepad')==-1 && print qq[failed $_ proces +s with: $!] for 1..65" failed 65 process with: Resource temporarily unavailable

Warning: If you decide to run the above, I'd recommend enabling the "Group similar taskbar buttons" on the taskbar properties page. It'll allow you to close all 64 notepads in one click "Close group" from the context menu.

The bit I do not understand about this is that the storing of the process handles for asynchronous processes appears to be deliberate. From Win32.c:Win32_spawnvp()

case P_NOWAIT: /* asynch + remember result */ if (w32_num_children >= MAXIMUM_WAIT_OBJECTS) { errno = EAGAIN; ret = -1; goto RETVAL; } ... if (mode == P_NOWAIT) { /* asynchronous spawn -- store handle, return PID */ ret = (int)ProcessInformation.dwProcessId; if (IsWin95() && ret < 0) ret = -ret; w32_child_handles[w32_num_children] = ProcessInformation.hProc +ess; w32_child_pids[w32_num_children] = (DWORD)ret; ++w32_num_children; }

Which suggests that the intent is that it should be possible to use wait to reap asynchronous kids and retrieve their exit codes, but nothing I've tried will allow this to work.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Slideshow using the Windows Picture and Fax Viewer by BrowserUk
in thread Slideshow using the Windows Picture and Fax Viewer by slloyd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.