On Wed, 07 Dec 2005, Américo Albuquerque wrote:
> The problem is that the server only work for around 20 connections, after
> that I get the "Can't fork: Resource temporarily unavailable" error. The
> function that does the fork has a exit so it exits from the child but it
> seams that it doesn't clean the resources used. Is there a way to make it
> work in windows?

You need to call waitpid() on all child processes to completely clean up
their resources.  There is a limit of about 63 simultaneous forked threads
in Perl on Windows, so I don't understand why you are only able to start 20.

I haven't tried this, but if you don't want to track all your child processes
by pid then you might get away by inserting this in front of your call to
fork():

    1 while waitpid(-1,1) > 0;

It should reclaim outstanding resources of all children that have already
terminated.  Your total number of simultaneous threads will still be limited
to some number below 64 though.

Cheers,
-Jan



_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to