Carbon-Cache accepts metrics with invalid names

Bug #1037672 reported by Dave Rawks on 2012-08-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Won't Fix

Bug Description

No attempt is made to validate that the metric name does not contain nulls or other characters no accepted by the os.path module's various functions. This results in an uncaught exception in the writer thread when attempting to flush metrics from cache to disk.

14/08/2012 09:52:02 :: Sorted 1012 cache queues in 0.000527 seconds
14/08/2012 09:52:02 :: Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/", line 167, in _worker
    result =, function, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/opt/graphite/lib/carbon/", line 158, in writeForever
  File "/opt/graphite/lib/carbon/", line 91, in writeCachedDataPoints
    for (metric, datapoints, dbFilePath, dbFileExists) in optimalWriteOrder():
  File "/opt/graphite/lib/carbon/", line 54, in optimalWriteOrder
    dbFileExists = exists(dbFilePath)
  File "/usr/lib/python2.7/", line 18, in exists
exceptions.TypeError: must be encoded string without NULL bytes, not str

To resolve this issue it would be appropriate to catch these bogus metric names in the writer thread and raise a log event AND to pop the metrics from the cache to prevent a situation where bad metrics/datapoints fill the cache but are unable to be flushed or otherwise removed.

Dave Rawks (drawks) wrote :

To reproduce send a metric with an embedded nulll character in the metric name to the tcp linereceiver.

Changed in graphite:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers