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

chore: [k219] fix(blooms): Fix panic in initialisation of the bloom planner and builder #14114

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

grafanabot
Copy link
Collaborator

Backport 8307c42 from #14110


What this PR does / why we need it:

The targets bloom-planner and bloom-builder panic at startup on branch main.

$ make loki && ./cmd/loki/loki -target=bloom-builder
CGO_ENABLED=0 go build -ldflags "-extldflags \"-static\" -s -w -X github.com/grafana/loki/v3/pkg/util/build.Branch=main -X github.com/grafana/loki/v3/pkg/util/build.Version=main-b29b4b4 -X github.com/grafana/loki/v3/pkg/util/build.Revision=b29b4b4bb -X github.com/grafana/loki/v3/pkg/util/build.BuildUser=christian@grafana1210 -X github.com/grafana/loki/v3/pkg/util/build.BuildDate=2024-09-11T08:30:11Z" -tags netgo -o cmd/loki/loki ./cmd/loki
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x287b590]

goroutine 1 [running]:
github.com/grafana/dskit/ring.(*BasicLifecycler).GetInstanceID(...)
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go:132
github.com/grafana/loki/v3/pkg/bloombuild/builder.New({{0x6400000, 0x6400000, {0x0, 0x0}, 0x0, 0x0, 0x0, {0x5f5e100, 0x2540be400, 0xa}, ...}, ...}, ...)
	/home/christian/sandbox/grafana/loki/pkg/bloombuild/builder/builder.go:92 +0x470
github.com/grafana/loki/v3/pkg/loki.(*Loki).initBloomBuilder(0xc002984008)
	/home/christian/sandbox/grafana/loki/pkg/loki/modules.go:1750 +0x4b6
github.com/grafana/dskit/modules.(*Manager).initModule(0xc000d2e6f0, {0x7ffe36edcb45, 0xd}, 0xc0027a22f8, 0xc0013ce960)
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/modules/modules.go:136 +0x1ea
github.com/grafana/dskit/modules.(*Manager).InitModuleServices(0xc000d2e6f0, {0xc000dbeed0, 0x1, 0x7510c18f88e2e5ce?})
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/modules/modules.go:108 +0xe8
github.com/grafana/loki/v3/pkg/loki.(*Loki).Run(0xc002984008, {0x0?, {0x4?, 0x2?, 0x6457fc0?}})
	/home/christian/sandbox/grafana/loki/pkg/loki/loki.go:497 +0x97
main.main()
	/home/christian/sandbox/grafana/loki/cmd/loki/main.go:129 +0x131e

This is because t.indexGatewayRingManager is not nil and therefore incorrectly tries to initialize the ring watcher, which fails.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

…lder (#14110)

The targets `bloom-planner` and `bloom-builder` panic at startup on branch `main`.

```console
$ make loki && ./cmd/loki/loki -target=bloom-builder
CGO_ENABLED=0 go build -ldflags "-extldflags \"-static\" -s -w -X github.com/grafana/loki/v3/pkg/util/build.Branch=main -X github.com/grafana/loki/v3/pkg/util/build.Version=main-b29b4b4 -X github.com/grafana/loki/v3/pkg/util/build.Revision=b29b4b4bb -X github.com/grafana/loki/v3/pkg/util/build.BuildUser=christian@grafana1210 -X github.com/grafana/loki/v3/pkg/util/build.BuildDate=2024-09-11T08:30:11Z" -tags netgo -o cmd/loki/loki ./cmd/loki
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x287b590]

goroutine 1 [running]:
github.com/grafana/dskit/ring.(*BasicLifecycler).GetInstanceID(...)
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go:132
github.com/grafana/loki/v3/pkg/bloombuild/builder.New({{0x6400000, 0x6400000, {0x0, 0x0}, 0x0, 0x0, 0x0, {0x5f5e100, 0x2540be400, 0xa}, ...}, ...}, ...)
	/home/christian/sandbox/grafana/loki/pkg/bloombuild/builder/builder.go:92 +0x470
github.com/grafana/loki/v3/pkg/loki.(*Loki).initBloomBuilder(0xc002984008)
	/home/christian/sandbox/grafana/loki/pkg/loki/modules.go:1750 +0x4b6
github.com/grafana/dskit/modules.(*Manager).initModule(0xc000d2e6f0, {0x7ffe36edcb45, 0xd}, 0xc0027a22f8, 0xc0013ce960)
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/modules/modules.go:136 +0x1ea
github.com/grafana/dskit/modules.(*Manager).InitModuleServices(0xc000d2e6f0, {0xc000dbeed0, 0x1, 0x7510c18f88e2e5ce?})
	/home/christian/sandbox/grafana/loki/vendor/github.com/grafana/dskit/modules/modules.go:108 +0xe8
github.com/grafana/loki/v3/pkg/loki.(*Loki).Run(0xc002984008, {0x0?, {0x4?, 0x2?, 0x6457fc0?}})
	/home/christian/sandbox/grafana/loki/pkg/loki/loki.go:497 +0x97
main.main()
	/home/christian/sandbox/grafana/loki/cmd/loki/main.go:129 +0x131e
````

This is because `t.indexGatewayRingManager` is not nil and therefore incorrectly tries to initialize the ring watcher, which fails.

---
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 8307c42)
@grafanabot grafanabot requested a review from a team as a code owner September 11, 2024 09:22
@grafanabot grafanabot added backport size/S type/bug Somehing is not working as expected labels Sep 11, 2024
@chaudum chaudum merged commit 9d66018 into k219 Sep 11, 2024
63 checks passed
@chaudum chaudum deleted the backport-14110-to-k219 branch September 11, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport size/S type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants