[collectd] Integer overflow in curl_json plugin

Garret Heaton powdahound at gmail.com
Wed Jun 23 01:00:10 CEST 2010


I've been using the curl_json plugin [1] to record stats from a
CouchDB [2] system and it was working fine until one of my databases
exceeded 2GB in size. Now, the disk size returned (in bytes) has
exceeded the max int size on the machine (it's 32-bit) and the plugin
fails when trying to parse the json.

The data returned looks like:
$ curl -s http://localhost:5984/foo | json_reformat
{
  "db_name": "foo",
  "doc_count": 2863693,
  "doc_del_count": 61249,
  "update_seq": 982083,
  "purge_seq": 0,
  "compact_running": false,
  "disk_size": 2226049133,
  "instance_start_time": "1276246242143350",
  "disk_format_version": 4
}

The error in the collectd log:
curl_json plugin: yajl_parse failed: parse error: integer overflow
#012          ct_running":false,"disk_size":2226049133,"instance_start_tim
#012                     (right here) ------^

The plugin uses the yajl [3] library for parsing json and is currently
making use of its integer and double callbacks. Apparently if the
number callback is used it'll use that for all numeric data. Is there
a way for collectd to capture the data in this way and use it in a
meaningful way (convert to a different unit, use a "wrapped around"
counter type, etc)? Or is the only option to use a 64-bit machine for
the collectd server?

Thanks!

1. http://collectd.org/wiki/index.php/Plugin:cURL-JSON
2. http://couchdb.apache.org/
3. http://lloyd.github.com/yajl/



More information about the collectd mailing list