php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78690 Database persistent connection leaks with ZTS and Event, Worker MPMs
Submitted: 2019-10-18 13:09 UTC Modified: 2021-06-10 13:47 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: coladict at gmail dot com Assigned:
Status: Open Package: MySQLi related
PHP Version: 7.2.23 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: coladict at gmail dot com
New email:
PHP Version: OS:

 

 [2019-10-18 13:09 UTC] 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.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-09 10:28 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem -Package: Apache2 related +Package: MySQLi related
 [2021-06-09 10:28 UTC] cmb@php.net
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.
 [2021-06-10 13:47 UTC] cmb@php.net
> 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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 17:01:30 2024 UTC