Re: What means "Fatal error: pcntl_fork(): Error 11"?

From: Date: Thu, 04 May 2006 20:45:42 +0000
Subject: Re: What means "Fatal error: pcntl_fork(): Error 11"?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-235567@lists.php.net to get a copy of this message
Hi again, After lots of testing I can say: It helped. I do still not exactly know why forking failed, but it seems to be somehow related to the high number of processes. I also do not understand why this is a *fatal* error, since it could easily be handled by returning -1 (like in the PHP docs). First I wanted to create a queue for tasks; instead of forking directly only a limited number of processes should be run from the queue, when one finishes another should start. But I decided not to do this, because the queue can easily grow to reach the memory limit. At last I decided to simply pause the script just before forking, if a maximum number of processes has been reached, until one has finished. Not optimal, since the parent process has a higher priority task, but at least it's stable now. To me it appears to be impossible to track if it was the maximum number of processes or a lack of any system resource. However, thank you all for your help. - Oz Robin Vickery wrote:
On 02/05/06, Oz <hellabri@gmail.com> wrote:
Hi, My script dies with the following line (after a few hours running without other errors/warnings/notices): Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297 Is there any documentation for "pcntl_fork(): Error 11"? Does anybody know what causes "pcntl_fork(): Error 11"? (It's PHP5 and the scripts source is top secret.)
The 11 is from errno.h and it corresponds to EAGAIN.
From the docs for fork() The fork() function shall fail if: [EAGAIN]
    The system lacked the necessary resources to create another process, or
     the system-imposed limit on the total number of processes under execution
     system-wide or by a single user {CHILD_MAX} would be exceeded.
Does that help? -robin


« previous php.general (#235567) next »