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

fix(blooms): Fix panic in initialisation of the bloom planner and builder #14110

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Sep 11, 2024

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

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@chaudum chaudum requested a review from a team as a code owner September 11, 2024 08:36
@chaudum chaudum added type/bug Somehing is not working as expected backport k218 backport k219 labels Sep 11, 2024
@grafanabot
Copy link
Collaborator

This PR must be merged before a backport PR will be created.

2 similar comments
@grafanabot
Copy link
Collaborator

This PR must be merged before a backport PR will be created.

@grafanabot
Copy link
Collaborator

This PR must be merged before a backport PR will be created.

@chaudum chaudum merged commit 8307c42 into main Sep 11, 2024
65 checks passed
@chaudum chaudum deleted the chaudum/fix-panic-bloom-planner-and-builder branch September 11, 2024 09:21
grafanabot pushed a commit that referenced this pull request Sep 11, 2024
…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 pushed a commit that referenced this pull request Sep 11, 2024
…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)
chaudum added a commit that referenced this pull request Sep 11, 2024
…lanner and builder (#14113)

Backport 8307c42 from #14110

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
chaudum added a commit that referenced this pull request Sep 11, 2024
…lanner and builder (#14114)

Backport 8307c42 from #14110

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport k218 backport k219 size/S type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants