Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integer divide by zero when using live / websocket #1941

Closed
FlorianLudwig opened this issue Apr 15, 2020 · 3 comments · Fixed by #1945
Closed

integer divide by zero when using live / websocket #1941

FlorianLudwig opened this issue Apr 15, 2020 · 3 comments · Fixed by #1945

Comments

@FlorianLudwig
Copy link
Contributor

Describe the bug

To Reproduce
Following the getting started:

  1. I installed grafana, loki and promtail using docker-compose
  2. "To see the logs, click Explore on the sidebar, select the Loki
    datasource in the top-left dropdown, and then choose a log stream using the
    Log labels button."
  3. Query: {filename="/var/log/dnf.log"} term
  4. Clicked Live
  5. Waited a bit
  6. "Bad Gateway" error appeared / loki crashed

Or maybe I first clicked live and then changed the query. In any case I was not yet able to reproduce this

Expected behavior

  • no crash

Environment:

loki, version k13-f86785b (branch: k13, revision: f86785b6)
  build user:       root@4bceb5defc91
  build date:       2020-04-14T16:33:11Z
  go version:       go1.13.10

Screenshots, Promtail config, or terminal output

loki_1      | level=info ts=2020-04-15T11:52:22.80544217Z caller=metrics.go:83 org_id=fake trace_id=7f4375a1c0697eb6 latency=fast query="{filename=\"/var/log/boot.log\"}" query_type=limited range_type=range length=1h0m1s step=1s duration=26.818979ms status=200 throughput_mb=0.0604907 total_bytes_mb=0.0016223
loki_1      | level=error ts=2020-04-15T11:52:43.590420331Z caller=http.go:227 msg="Error from client" err="websocket: close 1005 (no status)"
loki_1      | panic: runtime error: integer divide by zero
loki_1      | 
loki_1      | goroutine 344 [running]:
loki_1      | github.com/cortexproject/cortex/pkg/chunk.v11Entries.GetLabelWriteEntries(0x7fce00000000, 0x287a9a40287a8a4, 0xc000040820, 0xa, 0xc000040880, 0xb, 0x5265c00, 0x1aa4844, 0x4, 0xc000175280, ...)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/schema.go:933 +0xd0c
loki_1      | github.com/cortexproject/cortex/pkg/chunk.schema.GetCacheKeysAndLabelWriteEntries(0xc00041a270, 0x1e6b8c0, 0x2bc7d00, 0x1717daa4ca4, 0x1717daa4da4, 0x1aa46cc, 0x4, 0x1aa4844, 0x4, 0xc000175280, ...)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/schema.go:142 +0x456
loki_1      | github.com/cortexproject/cortex/pkg/chunk.(*seriesStore).calculateIndexEntries(0xc00010bb80, 0x1e4cd60, 0xc0001d2960, 0x1717daa4ca4, 0x1717daa4da4, 0x4ba07f3bc457104c, 0x1aa46cc, 0x4, 0x1717daa4ca4, 0x1717daa4da4, ...)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/series_store.go:501 +0x1a8
loki_1      | github.com/cortexproject/cortex/pkg/chunk.(*seriesStore).PutOne(0xc00010bb80, 0x1e4cd60, 0xc0001d2960, 0x1717daa4ca4, 0x1717daa4da4, 0x4ba07f3bc457104c, 0x1aa46cc, 0x4, 0x1717daa4ca4, 0x1717daa4da4, ...)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/series_store.go:464 +0x225
loki_1      | github.com/cortexproject/cortex/pkg/chunk.compositeStore.Put.func1(0x1717daa4ca4, 0x1717daa4da4, 0x1e6b260, 0xc00010bb80, 0x7fce9c7574e8, 0x2)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/composite_store.go:81 +0xd3
loki_1      | github.com/cortexproject/cortex/pkg/chunk.compositeStore.forStores(0xc000111f20, 0x1, 0x1, 0x1717daa4ca4, 0x1717daa4da4, 0xc000aff860, 0x1b224b8, 0xc000aff888)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/composite_store.go:217 +0x1e0
loki_1      | github.com/cortexproject/cortex/pkg/chunk.compositeStore.Put(0xc000111f20, 0x1, 0x1, 0x1e4cd20, 0xc000167260, 0xc000175300, 0x1, 0x1, 0x4a8a70, 0xc000276c60)
loki_1      | 	/src/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/composite_store.go:80 +0x14b
loki_1      | github.com/grafana/loki/pkg/ingester.(*Ingester).flushChunks(0xc000133180, 0x1e4cd20, 0xc000167260, 0x4ba07f3bc457104c, 0xc000762540, 0x2, 0x2, 0xc000118360, 0x1, 0x1, ...)
loki_1      | 	/src/loki/pkg/ingester/flush.go:330 +0x7ec
loki_1      | github.com/grafana/loki/pkg/ingester.(*Ingester).flushUserSeries(0xc000133180, 0x1aa46cc, 0x4, 0x4ba07f3bc457104c, 0x0, 0x0, 0x0)
loki_1      | 	/src/loki/pkg/ingester/flush.go:217 +0x274
loki_1      | github.com/grafana/loki/pkg/ingester.(*Ingester).flushLoop(0xc000133180, 0xc)
loki_1      | 	/src/loki/pkg/ingester/flush.go:189 +0x304
loki_1      | created by github.com/grafana/loki/pkg/ingester.New
loki_1      | 	/src/loki/pkg/ingester/ingester.go:144 +0x360
@cyriltovena
Copy link
Contributor

This is a problem only on master, I think @owen-d is fixing it.

@owen-d
Copy link
Member

owen-d commented Apr 15, 2020

Yes, we accidentally added a build that had this problem. Please use the grafana/loki:1.4.1 build and not k13-f86785b. The problem was caused because that docker compose file uses grafana/loki:latest by default, which briefly pointed to the problematic build.

@FlorianLudwig
Copy link
Contributor Author

@owen-d i changed the image as you suggested in #1945

owen-d pushed a commit that referenced this issue Apr 15, 2020
While the [documentation](https://github.com/grafana/loki/blob/master/docs/installation/docker.md) does version pin the links to specific versions of the docker-compose file, the file it docker-compose file does use the `latest` tag for loki.

For an example of issues this causes see #1941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants