Influxdb addon - dropped x old events

Lately I get this kind of warnings and errors every few seconds/minutes.

Catching up, dropped 31 old events
12:54 components/influxdb.py (WARNING)

Write error
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/influxdb.py", line 316, in write_to_influxdb
    self.influx.write_points(json)
  File "/usr/local/lib/python3.6/site-packages/influxdb/client.py", line 490, in write_points
    tags=tags, protocol=protocol)
  File "/usr/local/lib/python3.6/site-packages/influxdb/client.py", line 551, in _write_points
    protocol=protocol
  File "/usr/local/lib/python3.6/site-packages/influxdb/client.py", line 327, in write
    headers=headers
  File "/usr/local/lib/python3.6/site-packages/influxdb/client.py", line 286, in request
    raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"partial write: field type conflict: input field \"state\" on measurement \"state\" is type float, already exists as type string dropped=4"}

Resumed, lost 100 events
12:52 components/influxdb.py (ERROR)

What does it mean? My storage space sensor tells me that I habe 48GB free space.

No one had that issue before?

Yes I see the dropped events, but the python exception is fixed I think.

Currently I can’t see any dropped events or exceptions because of another issue I have with Influxdb.

Influxdb doesn’t start, what I get is this:

lvl=error msg="Cannot read corrupt tsm file, renaming"
error="cannot allocate memory"
fatal error: out of memory

I will probably have to open a new topic on this.

1 Like

Did you ever get this resolved? I have the same issue. Every few seconds sensors give this exact error input field \"state\" on measurement \"state\" is type float

Unfortunately no, so if you find a solution I would be interested as well.

BTW when you say „sensors“, which sensors do you mean?

I mean all kind of sensors which have a field state and publish to influxdb. They all give an error now.

Pretty sure the error was introduced since I added some MQTT sensors yesterday and they have an field state which is a float value. The influxDB already contained a lot of measurements where the state field is of type string which causes this issue.

I went ahead and installed influxDB CLI client on another computer and removed all state measurements:
DROP measurement state
I was only aggregating data for 3 weeks so I’m not to worried about losing the history.

Also I changed the mqtt sensors I created yesterday to cast the state to string.

This solved my issue, the errors disappeared from the logs.

1 Like

Did the errors you got include the names of the sensors that caused them? I’m asking because it seems like the error mentioned in my first post doesn’t include the name of the sensor or entity that caused it.

Above the error you see the JSON data which is posted to InfluxDB, when you copy this and paste it into a json prettyprint and so a search for all occurences of “state”, you will see which sensor is the problem.

1 Like

I’m using influxdb 1.8.4 in a docker container with a supervised homeassistant setup (one that isn’t officially supported) and had the same CPU issues.

I’ve just culled the database entries as @bramski mentioned above with the DROP measurement state, and then rebuilt the index files using the procedure outlined on the official docs here.

CPU utilization on a Raspberry Pi 4 (4GB) went from over 70% to well under 10%. I’ll check again in a month once there’s more state measurements stored in the database to see if its a recurring problem, and in which case I’ll try converting the MQTT data to strings instead of the floats they’re currently using.

Cheers!