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 "<pre>";
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
From my investigation an internal library Excelsior Jet is creating the extra threads, which I need to release.
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 "<pre>";
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