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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux