go-graphite/graphite-clickhouse

seriesByTag('') causes "index out of range [0] with length 0"

Karsonito opened this issue · 6 comments

Hello!
I ran into this problem: request seriesByTag('') (with empty value) leads to panic exit:

graphite-clickhouse[40095]: goroutine 2610411 [running]:"
graphite-clickhouse[40095]: panic: runtime error: index out of range [0] with length 0"
graphite-clickhouse[40095]: github.com/lomik/graphite-clickhouse/finder.TaggedWhere({0x249e178, 0x0, 0xc000108cc8})"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/finder/tagged.go:278 +0x139"
graphite-clickhouse[40095]: github.com/lomik/graphite-clickhouse/finder.(*TaggedFinder).Execute(0x19aaa18, {0x19aaac0, 0xc000548ed0}, {0xc00052c250, 0xc000649630}, 0x6360f146, 0x636145a6)"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/finder/finder.go:82 +0x84"
graphite-clickhouse[40095]: github.com/lomik/graphite-clickhouse/render.(*Handler).ServeHTTP.func2({0xc000076ea0, 0xc000649778, 0xc000649748}, {0xc00052c250, 0xf}, 0xc00054e7e0)"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/render/handler.go:74 +0xfd1"
graphite-clickhouse[40095]: github.com/lomik/graphite-clickhouse/finder.(*TaggedFinder).ExecutePrepared(0xc00075e820, {0x19aaac0, 0xc000548ed0}, {0x249e178, 0x531acb2900000001, 0x0}, 0x6360f146, 0x636145a6)"
graphite-clickhouse[40095]: created by github.com/lomik/graphite-clickhouse/render.(*Handler).ServeHTTP"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/finder/tagged.go:308 +0x67"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/finder/tagged.go:304 +0x85"
graphite-clickhouse[40095]: github.com/lomik/graphite-clickhouse/finder.Find(0xc000083860, {0x19aaac0, 0xc000548ed0}, {0xc00052c250, 0xf}, 0xc000649638, 0xc0006496f0)"
graphite-clickhouse[40095]: #011/home/runner/work/graphite-clickhouse/graphite-clickhouse/render/handler.go:77 +0xfe"

May be it similar to #150 ?

Version: 0.13.2

Please fix )

Thanks for report. Fixed in current muster.

Unfortunately, it didn't help (
Because it doesn't fix panic error caused by an empty string (it's not the same as 0 arguments)

In 0.13.2:
seriesByTag()

[2022-11-07T21:27:45.743Z] ERROR [render] find {"request_id": "df07c35c2799cb3fb34a8799f27aef9a", "error": "wrong seriesByTag call: \"seriesByTag()\""}

seriesByTag('')

panic: runtime error: index out of range [0] with length 0

In master:
seriesByTag()

[2022-11-07T21:33:33.551Z] ERROR [render] find {"request_id": "b73e8fdd9e3ca9e2f6d9703d04358e5c", "carbonapi_uuid": "5b8e997d-f577-4643-9753-b548680773fe", "error": "wrong seriesByTag call"}

seriesByTag('')

panic: runtime error: index out of range [0] with length 0

Unfortunately, it didn't help ( Because it doesn't fix panic error caused by an empty string (it's not the same as 0 arguments)

In 0.13.2: seriesByTag()

[2022-11-07T21:27:45.743Z] ERROR [render] find {"request_id": "df07c35c2799cb3fb34a8799f27aef9a", "error": "wrong seriesByTag call: \"seriesByTag()\""}

seriesByTag('')

panic: runtime error: index out of range [0] with length 0

In master: seriesByTag()

[2022-11-07T21:33:33.551Z] ERROR [render] find {"request_id": "b73e8fdd9e3ca9e2f6d9703d04358e5c", "carbonapi_uuid": "5b8e997d-f577-4643-9753-b548680773fe", "error": "wrong seriesByTag call"}

seriesByTag('')

panic: runtime error: index out of range [0] with length 0

It must be done at now.

Now it worked!
Thx!

Are you planning to make a release?

Yes, release planned some later. Now one PR is testing and plan fix one issue. So may be on this/next week.