php / php/php-src

Non-persistent MySQL connections are not being closed in Cacti.

Open
#11,750 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: pdo (core) Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

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:

https://github.com/Cacti/cacti/issues/5401

PHP Version

PHP 8.1.2-1ubuntu2.13

Operating System

Ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the connection growth in the cactid and flow-capture daemons under PHP 8.1.2 with non-persistent MySQL connections, using the linked Cacti issue as context. Trace the PDO connection lifecycle during repeated five-minute polls; done means connections are released instead of accumulating until MySQL reaches its limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.