Re: Help please: child processes are not killed when PHP is done

From: Date: Thu, 17 May 2018 14:04:09 +0000
Subject: Re: Help please: child processes are not killed when PHP is done
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-102117@lists.php.net to get a copy of this message
From my investigation an internal library Excelsior Jet is creating the extra threads, which I need to release. > On 17 May 2018, at 09:57, O'Neil Delpratt <oneil@saxonica.com> wrote: > > Hi All, > > I am experiencing a strange behaviour in my PHP extension. My setup: Ubuntu LTS 16, Apache 2.4, > PHP 7.0.30 (tested with PHP 7.1.17) and latest Saxon-HE/C 64bit. > > Observed behaviour is that Apache spawns a couple of child processes as soon as Saxon is > invoked. Problem is that those child processes are not killed when PHP is done. > > Code > <?php > // output current PID and number of threads > $pid = getmypid(); > $child_threads = trim(ls /proc/{$pid}/task | wc -l); > > echo "&lt;pre&gt;"; > echo "Process ID :$pid".PHP_EOL; > echo "Number of threads: $child_threads".PHP_EOL; > echo str_repeat("-", 20).PHP_EOL; > > $sax = new Saxon\SaxonProcessor(); > > // output number of threads again > $child_threads = trim(ls /proc/{$pid}/task | wc -l).PHP_EOL; > echo "Number of threads: $child_threads".PHP_EOL; > /> > > > Gives the output: > > Process ID: 5591 Number of threads: 1 ——————— Number of threads: 9 > > Running that code snippet, I see that additional 9 child threads are running, but they stay > alive until I manually kill them. > > Source code of php extension: > https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.API/php7_saxon.cpp > <https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.API/php7_saxon.cpp>

« previous php.internals (#102117) next »