Re: Re: Fork and zombies
| From: | Per Jessen | Date: | Tue, 17 Mar 2009 21:16:04 +0000 |
| Subject: | Re: Re: Fork and zombies | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290186@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
> Per Jessen schreef:
>> Waynn Lue wrote:
>>
>>> (Apologies for topposting, I'm on my blackberry). Hm, so you think
>>> exiting from the child thread causes the db resource to get
>>> reclaimed?
>>>
>>
>> Yeah, something like that. The connection is definitely closed when
>> the child exits.
>>
>
> I can confirm this. you definitely need to open a connection for each
> child process. if you require a db connection in the parent process,
> you should close it before forking (and then reopen it afterwards if
> you still need it).
Yep, exactly my thinking.
> at least that's what I found I had to do when I ran into this.
> incidently my forking loop looks like this, very interested to know if
> Per can spot any obvious stupidity:
I doubt it.
I can't quite follow your code after the pcntl_wait where you've got a
pcntl_kill(), but it looks like an insurance policy? "just in case" ?
/Per
--
Per Jessen, Zürich (7.0°C)