You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-persistent MySQL connections are not being closed in Cacti. #11750
I have been investigating a problem with Cacti where it opens a new database connection on every 5 minute poll interval, and never closes them, eventually running the DB server out of connections, even with the max_connections set to 1000. It is a new install of Cacti, I am not upgrading.
Eventually I figured out that configuring Cacti to use persistent database connections solved the issue. So there is a workaround.
I am seeing the biggest problem with the long-running daemons, one for cacti itself called cactid, the other for a cacti plugin called flowview. The service for that one is called "flow-capture".
The cacti project is claiming that they have never had to worry about closing connections before and they think something probably changed in PDO.
This is the issue I opened on Cacti for the problem:
Activity
Girgias commentedon Jul 21, 2023
That would require bisecting commits, as there have been several changes in PDO but none that I can see which would change that behaviour.
MohamedAbuZamil commentedon Aug 3, 2023
kamil-tekiela commentedon Nov 8, 2026
That sounds like a problem in Cacti code, not in PHP. I don't know what they are doing but they are storing it twice in globals: https://github.com/Cacti/cacti/blob/18500fa313a9f1ee1be48aa111c0eeea001010fa/lib/database.php#L121-L126 and they leak it by reopeninig a new connection https://github.com/Cacti/cacti/blob/18500fa313a9f1ee1be48aa111c0eeea001010fa/lib/database.php#L262-L288