Bug #81113 [Opn->Nab]: PDO holds some non-GCable reference

From: Date: Wed, 09 Jun 2021 10:06:38 +0000
Subject: Bug #81113 [Opn->Nab]: PDO holds some non-GCable reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234278@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81113&edit=1 ID: 81113 Updated by: nikic@php.net Reported by: m at m dot cz Summary: PDO holds some non-GCable reference -Status: Open +Status: Not a bug Type: Bug Package: PDO related Operating System: any PHP Version: 8.0.7 Block user comment: N Private report: N New Comment: Closing per above comment. Previous Comments: ------------------------------------------------------------------------ [2021-06-09 10:04:21] m at m dot cz I have futher looked into this issue with following: a) the main issue is that PHPUnit TestCase is instanciated per test (correct), but PHPUnit does not destroy these instances after the test is completed, but keep that instances referenced until all tests are done (wrong, but PHP works correctly). PHPUnit issue: https://github.com/sebastianbergmann/phpunit/issues/4705 b) https://github.com/atk4/data/commit/0c152f228d27a4ff81223387d881cd7324fe0fb4#diff-2396b34d8258dc49e2597630cd485205d02402dbbc6dd7704c8493cbf9a6ea04R42 even then gc_collect_cycles() is needed to be called at least twice. Reported as https://bugs.php.net/bug.php?id=81117. This bug report can be closed. ------------------------------------------------------------------------ [2021-06-08 12:44:39] nikic@php.net I tried this script https://gist.github.com/nikic/a55b70d6b7c1acf6785c7e50c37754dc based on the dbal issue, but it does not show a memory leak on PHP 8.1 (or PHP 8.0, or PHP 7.4). So whatever issue that hit, it seems to have been fixed. The memory leak reported in bug #75190 is also fixed. If there is some reasonably minimal way to reproduce, I'm happy to address other GC problems as well. I don't want to reduce this down from "using doctrine dbal, somewhere, somehow" though. ------------------------------------------------------------------------ [2021-06-08 12:31:53] m at m dot cz It seems it is related with: https://github.com/doctrine/dbal/issues/3047 and https://bugs.php.net/bug.php?id=75190 which describes a GC issue when PDO class is extended, hovewer, it is marked as "not a bug". Why it is not a bug or is it technically impossible to provide full GC support? ------------------------------------------------------------------------ [2021-06-08 11:52:05] nikic@php.net Okay, I think this will need some more reduced code to make progress. PDO generally does support GC, and since PHP 8.1 also supports per-driver GC. So this probably requires that some specific feature is being used. ------------------------------------------------------------------------ [2021-06-08 09:31:44] m at m dot cz At least pdo_mysql is affected, as when max. connection count is limited (by ALTER USER user@% WITH MAX_USER_CONNECTIONS 10;), connection limit is hit. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=81113 -- Edit this bug report at https://bugs.php.net/bug.php?id=81113&edit=1

« previous php.bugs (#234278) next »