PHP CLI Forking Problem

From: Date: Fri, 22 Oct 2004 10:53:06 +0000
Subject: PHP CLI Forking Problem
Groups: php.general 
Request: Send a blank email to php-general+get-200076@lists.php.net to get a copy of this message
Hi, We've got a script setup that forks a number of child processes, using pcntl_fork. When a child finishes we capture the SIGCHLD, do pcntl_wait, and then fork of another child. This has worked fine in one script but now using exactly the same forking code in another script has resulted in problems. Now it seems, the child will get to the exit but the exit function will not actually complete. I'm not sure what's likely to be causing this, I was wondering if the child was waiting for the parent to finish with resources perhaps? But the other forking script has similar resources setup too. I tried stracing the running child process and got nothing out. I tried gdb on the running process and got the following: q = p; (gdb) 554 p = p->pListNext; (gdb) 555 if (ht->pDestructor) { (gdb) 556 ht->pDestructor(q->pData); (gdb) 558 if (!q->pDataPtr && q->pData) { (gdb) 561 pefree(q, ht->persistent); (gdb) 555 if (ht->pDestructor) { Basically it's looping on those commands over and over... Now I think about it that could just be it freeing up each individual allocated bit of memory, but I've left it running for ten minutes and the children still didn't manage to finish. Anyone got any thoughts? Thanks, John McKerrell

« previous php.general (#200076) next »