Doc #78690 [Com]: Database persistent connection leaks with ZTS and Event, Worker MPMs

[email protected] ("schamberumarcelo at gmail dot com") Wed, 23 Nov 2022 05:45:32 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=78690&edit=1

 ID:                 78690
 Comment by:         schamberumarcelo at gmail dot com
 Reported by:        coladict at gmail dot com
 Summary:            Database persistent connection leaks with ZTS and
                     Event, Worker MPMs
 Status:             Open
 Type:               Documentation Problem
 Package:            MySQLi related
 Operating System:   Linux
 PHP Version:        7.2.23
 Block user comment: N
 Private report:     N

 New Comment:

In Maximo, go to Logging. Filter for dbconnection (log4j.logger.maximo.dbconnection). The default Log Level for this logger is WARN. Change the Log Level to INFO. Click Apply Settings.
(https://www.myccpay.me)github.com


Previous Comments:
------------------------------------------------------------------------
[2021-06-10 13:47:55] [email protected]

> For prefork MPM, all child processes have access to that process
> memory, […]

No, that is not the case[1].

The point here is likely that some MPMs stop worker
processes/threads from time to time, and that newly started
processes/threads will have EG(persistent_list) empty.

[1] <https://bugs.php.net/bug.php?id=63343#1623327171>

------------------------------------------------------------------------
[2021-06-09 10:28:56] [email protected]

Persistent connections are stored in process memory, not in any
kind of shared memory.  For prefork MPM, all child processes have
access to that process memory, for worker MPM they have not, so
each child process has its opwn set of persistent connections.
It's the same with (F)CGI.  That should be documented.

------------------------------------------------------------------------
[2019-10-18 13:09:25] coladict at gmail dot com

Description:
------------
When using the Prefork MPM, persistent MySQLi connections (for example, but not limited to MySQLi) are reused.
When using other MPMs, they are not. For traced it to:

ext/mysqli/mysqli_nonapi.c: 166

The EG(persistent_list) macro always returns a new list. This results in reaching the MySQL server's connection limit (default at 151) with having all of them waiting in sleep.





------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78690&edit=1