|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66088 Connections to rrdcached are never closed
Submitted: 2013-11-13 13:09 UTC Modified: 2014-01-14 09:49 UTC
From: killing at multiplay dot co dot uk Assigned: koubel (profile)
Status: Closed Package: rrd (PECL)
PHP Version: Irrelevant OS: FreeBSD
Private report: No CVE-ID: None
 [2013-11-13 13:09 UTC] killing at multiplay dot co dot uk
If rrdcached is used then the connections to the daemon are never closed resulting in more and more socket resources being consumed the more php-fpm handlers are active.

The attached patch adds support for rrdcached connections which adds:
1. rrdc_disconnect method, allowing the user to manually disconnect any active connection.
2. rrdc_persistent_connections(enabled) method which allows the user to configure rrd to support persistent connections.
3. RRDC_PERSISTENT_CONNECTIONS compile time define which allows the use to change default for persistent connections (default is disabled).
4. Module shutdown handler which always closes any active rrdcached connection
5. Request shutdown handler which closes any active rrdcached connection depending on the current rrdc persistent connection setting.

Test script:
Complete the following replacing the required variables (<host>, <file>, <options>) with valid values, then run the script via a php-fpm instance.
rrd_update('<file>', '<options>');

Once run, check for open connections to <host> e.g.
netstat -an |grep <host>

You'll see ESTABLISHED connections even though the script is no longer running so doesn't require the connection any more.

Expected result:
Running the following should return no ESTABLISHED connections
netstat -na | grep <host>

Actual result:
All php-fpm instances which have run the script have an ESTABLISHED connection to <host>


rrdcached-disconnect-support (last revision 2013-11-13 13:11 UTC by killing at multiplay dot co dot uk)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-13 21:10 UTC]
Automatic comment from SVN on behalf of koubel
Log: support for the rrd cache daemon connection #66088
 [2014-01-13 21:19 UTC]
-Status: Open +Status: Feedback
 [2014-01-13 21:19 UTC]
In your solution, persistent connection handling is little bit complicated.
Simple and clear way is let the developer when he wants to close connection through new function rrdc_disconnect e.g. at the end of request.

Try to verify current trunk version.
 [2014-01-14 09:49 UTC]
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: koubel
 [2014-01-14 09:49 UTC]
New package with the extension released.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 17:03:37 2021 UTC