[rrdtool-maint] Bug#874607: rrdcached: truncates column name list on FETCH

roma1390 roma1390 at gmail.com
Thu Sep 7 20:23:50 UTC 2017


Package: rrdcached
Version: 1.6.0-1+b2
Severity: normal
Tags: upstream patch


Problem 
-------
rrdcached has to small constant size buffer for ds names, and silently
ignores if this buffer is to small

Affected
--------
rrdtool graph with --daemon uses command FETCH to get data from rrdached
if rrdcached triggers buffer shortage, then will return truncated line of DS's

rrdtool can't deal with this situation and will report somehow misleading error.

How to reproduce
----------------
(assume rrdcached is started with suitable arguments)

1. Create rrd db:

	$ rrdtool create a.rrd \
        	`
	        for i in $(seq 60)
        	do
	                echo "DS:very_long_name_$i:COUNTER:5:U:U"
        	done
	        ` \
        	RRA:LAST:0.5:1:5

2. Fetch data from rrdcached:
	$ rrdtool fetch -d unix:rrdcached.sock a.rrd LAST > /dev/null
	ERROR: rrdc_fetch: Unable to parse header `DSName'

Also rrdcached will write some message to syslog:

	send_response: could not write results

Posible fixes
-------------

1. Increase buffer size
(patch attached)

2. Add warning to README.Debian

3. Add warning to documentation (man pages)

4. Make buffer size dynamic

5. Add runtime checks on create

-- System Information:
Debian Release: 9.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-openvz-042stab120.19-amd64 (SMP w/1 CPU core)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages rrdcached depends on:
ii  libc6                2.24-11+deb9u1
ii  libcairo2            1.14.8-1
ii  libdbi1              0.9.0-4+b2
ii  libglib2.0-0         2.50.3-2
ii  libpango-1.0-0       1.40.5-1
ii  libpangocairo-1.0-0  1.40.5-1
ii  libpng16-16          1.6.28-1
ii  librrd8              1.6.0-1+b2
ii  libxml2              2.9.4+dfsg1-2.2

rrdcached recommends no packages.

rrdcached suggests no packages.

-- debconf-show failed
-------------- next part --------------
diff -Naur rrdtool-1.6.0-org/src/rrd_daemon.c rrdtool-1.6.0/src/rrd_daemon.c
--- rrdtool-1.6.0-org/src/rrd_daemon.c	2016-04-19 15:50:56.000000000 +0000
+++ rrdtool-1.6.0/src/rrd_daemon.c	2017-09-07 09:42:23.483407001 +0000
@@ -1918,7 +1918,7 @@
   add_response_info (sock, "Step: %lu\n", parsed.step);
 
   { /* Add list of DS names */
-    char linebuf[1024];
+    char linebuf[4096];
     size_t linebuf_fill;
 
     memset (linebuf, 0, sizeof (linebuf));
@@ -1939,7 +1939,7 @@
        t <= parsed.end_tm;
        t += parsed.step,j++)
   {
-    char linebuf[1024];
+    char linebuf[4096];
     size_t linebuf_fill;
     char tmp[128];
 


More information about the pkg-rrdtool-maint mailing list