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

From: Date: Thu, 17 May 2018 08:57:55 +0000
Subject: Help please: child processes are not killed when PHP is done
Groups: php.internals 
Request: Send a blank email to internals+get-102114@lists.php.net to get a copy of this message
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 (#102114) next »