oetiker / rrdtool-1.x

RRDtool 1.x - Round Robin Database
http://www.rrdtool.org
GNU General Public License v2.0
1.02k stars 264 forks source link

rrdcached client truncate 'rrdtool info' output #1080

Open DeHackEd opened 4 years ago

DeHackEd commented 4 years ago

Describe the bug When an rrdfile has a DS whose last_ds value is an empty string the rrdc_client errors out during network protocol parsing and truncates the output of the protocol.

When last_ds is the empty string the protocol parser interprets the empty string as an error and aborts processing the result. The incomplete output is then returned to the client. I'm not sure how this situation specifically came about.

To Reproduce

  1. Have a working rrdcached service
  2. Via whatever means produce an .rrd file where a DS has a last_ds value of the empty string.
  3. Run rrdtool info -d /tmp/rrdcached.sock thisfile.rrd

Expected behavior Output of rrdtool info thisfile.rrd with and without daemon parameter is identical (or close enough)

Instead the output is truncated where the first ds[DSNAME].last_ds value should be, and last_ds is missing.

Screenshots

# rrdtool info -d /tmp/rrdcached.sock [filename]
filename = "[filename]"
rrd_version = "0003"
step = 300
last_update = 1586092083
header_size = 7376
ds[ifHCInOctets].index = 0
ds[ifHCInOctets].type = "COUNTER"
ds[ifHCInOctets].minimal_heartbeat = 500
ds[ifHCInOctets].min = 0.0000000000e+00
ds[ifHCInOctets].max = 1.0000000000e+15

Actual truncated output from testing. RRDfile actualy has 8 DS and 7 RRA entries

System

Additional context Commenting out these two lines is a functional, if ugly, workaround.

oetiker commented 4 years ago

the interesting bit in my eyes is to figure out how last_ds can become an empty value ...

DeHackEd commented 4 years ago

I don't know, but I swear this did happen.

The only oddity I can think of is that, since it's a custom build of rrdtool, there may have been something left over from the old version. The app is Perl based so if RRDs were out of date... That is the only thing that comes to mind.