hassio-addons/addon-influxdb

Runtime error - invalid memory address or nill pointer dereference

ghulleman opened this issue · 2 comments

Problem/Motivation

With a flux query, an aggregate window with fn:max yields results, but a sum gives a "panic: runtime error: invalid memory address or nill dereference

Failes:
from(bucket: "retentiondb/infinite")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "Wh")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["entity_id"] == "sb3_6_1av_40_563_daily_yield")
|> aggregateWindow(every: 1mo, fn:sum)

2024-03-28_21-29-08

Works:
from(bucket: "retentiondb/infinite")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "Wh")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["entity_id"] == "sb3_6_1av_40_563_daily_yield")
|> aggregateWindow(every: 1mo, fn:max)
Only difference is the 'fn:max' / 'fn:sum'

2024-03-28_21-28-36

Found influxdata/influxdb#21649 (not this addon), more people have this issue.

Expected behavior

Expect to get a bar graph with a total per month of generated kWh of a converter.

Actual behavior

Gives a "panic: runtime error: invalid memory address or nill dereference"

Steps to reproduce

  • Create a database 'rententiondb' with a retention policy 'infinite'.
  • Create a database 'temp_import'
  • Write data via influx addon to temp_import database, set precision to 's'
    influx upload.txt
  • Using the explorer window, execute "SELECT * INTO retentiondb.infinite.Wh FROM import_temp.autogen.Wh group by *" to import data to rentention/infinite.
  • Use explorer window, execute flux query:
    from(bucket: "retentiondb/infinite")
    |> range(start: -1y)
    |> filter(fn: (r) => r["_measurement"] == "Wh")
    |> filter(fn: (r) => r["_field"] == "value")
    |> filter(fn: (r) => r["entity_id"] == "sb3_6_1av_40_563_daily_yield")
    |> aggregateWindow(every: 1mo, fn:sum)

Proposed changes

I think I did run into this as well. Suggested fix from influx forum is only to upgrade to latest influx 2.x.

See https://community.influxdata.com/t/how-to-get-a-cumulative-sum-of-a-product-from-different-series/33820/10

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!