Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92185 invoked from network); 17 May 2018 14:04:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2018 14:04:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=oneil@saxonica.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=oneil@saxonica.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain saxonica.com from 94.136.40.146 cause and error) X-PHP-List-Original-Sender: oneil@saxonica.com X-Host-Fingerprint: 94.136.40.146 mailex.mailcore.me Received: from [94.136.40.146] ([94.136.40.146:35514] helo=mailex.mailcore.me) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/DA-16557-DDB8DFA5 for ; Thu, 17 May 2018 10:04:14 -0400 Received: from [82.152.109.221] (helo=[10.0.0.7]) by smtp04.mailcore.me with esmtpa (Exim 4.89) (envelope-from ) id 1fJJVq-0004CR-Bb for internals@lists.php.net; Thu, 17 May 2018 15:04:10 +0100 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: <01563BB9-9FFE-46A7-8860-ABAC51366DE9@saxonica.com> Date: Thu, 17 May 2018 15:04:09 +0100 Content-Transfer-Encoding: quoted-printable Message-ID: <9785C5FC-1450-419D-A754-7B7900841602@saxonica.com> References: <01563BB9-9FFE-46A7-8860-ABAC51366DE9@saxonica.com> To: PHP internals X-Mailer: Apple Mail (2.3124) X-Mailcore-Auth: 439400269 X-Mailcore-Domain: 1881035 X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Status: not scanned, license restriction X-KLMS-AntiPhishing: not scanned, license restriction X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.721, bases: 2018/05/17 07:40:00 #8421627 X-KLMS-AntiVirus-Status: Clean, skipped Subject: Re: [PHP-DEV] Help please: child processes are not killed when PHP is done From: oneil@saxonica.com (O'Neil Delpratt) =46rom 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 wrote: >=20 > Hi All, >=20 > 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. >=20 > 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. >=20 > Code > // output current PID and number of threads > $pid =3D getmypid(); > $child_threads =3D trim(`ls /proc/{$pid}/task | wc -l`); >=20 > echo "<pre>"; > echo "Process ID :$pid".PHP_EOL; > echo "Number of threads: $child_threads".PHP_EOL; > echo str_repeat("-", 20).PHP_EOL; >=20 > $sax =3D new Saxon\SaxonProcessor(); >=20 > // output number of threads again > $child_threads =3D trim(`ls /proc/{$pid}/task | wc -l`).PHP_EOL; > echo "Number of threads: $child_threads".PHP_EOL; > /> >=20 >=20 > Gives the output: >=20 > Process ID: 5591 Number of threads: 1 =E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94 Number of threads: 9 >=20 > Running that code snippet, I see that additional 9 child threads are = running, but they stay alive until I manually kill them. >=20 > Source code of php extension: = https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.AP= I/php7_saxon.cpp =