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

panic: runtime error: invalid memory address or nil pointer dereference #25

Closed
san360 opened this issue Aug 13, 2020 · 4 comments
Closed

Comments

@san360
Copy link

san360 commented Aug 13, 2020

Error on WSL1 windows OS

`❯ kubent
2:44PM INF >>> Kube No Trouble kubent <<<
2:44PM INF version 0.3.0 (git sha dev)
2:44PM INF Initializing collectors and retrieving data
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1154c15]

goroutine 1 [running]:
github.com/doitintl/kube-no-trouble/pkg/collector.(*ClusterCollector).Name(0x0, 0x1823920, 0xc000361b80)
:1 +0x5
main.storeCollector(0x182ac00, 0x0, 0x1823920, 0xc000361b80, 0x2331290, 0x0, 0x0, 0x0, 0x0, 0x16649b5)
/__w/kube-no-trouble/kube-no-trouble/cmd/kubent/main.go:40 +0x151
main.initCollectors(0xc000223630, 0x16649b5, 0x2b, 0xc0002ce540)
/__w/kube-no-trouble/kube-no-trouble/cmd/kubent/main.go:51 +0x3a7
main.main()
/__w/kube-no-trouble/kube-no-trouble/cmd/kubent/main.go:88 +0x31c`

@stepanstipl
Copy link
Contributor

Hi @san360 thanks for reporting this. I'll certainly try to look into this, but tbh. it might take some time, I'm not familiar with WSL at all ;). Are you able to try with WSL2 - partially out of curiosity on my side, no idea if that might help, but my colleague mentioned there were many improvements/bugfixes since the WSL1.

As a workaround, I would suggest you try to use docker image. We're not publishing it anywhere yet (tbd soon), but just recently added it to the repo, so just building the image from Dockerfile in the root of this repo should work.

@manute
Copy link
Contributor

manute commented Sep 1, 2020

I have the same error, in mac osx and version 0.3.0 and I think is due to a bad kube config, so I've created a PR to avoid the panic and the error is showing up like:

> ./bin/kubent                                                                                                                                                                                (use1-test-4/default)
3:32PM INF >>> Kube No Trouble `kubent` <<<
3:32PM INF version dev (git sha dev)
3:32PM INF Initializing collectors and retrieving data
3:32PM ERR Failed to initialize: <nil> error="invalid configuration: [context was not found for specified context: test-cluster, cluster has no server defined]"
3:32PM ERR Failed to initialize: <nil> error="invalid configuration: [context was not found for specified context: test-cluster, cluster has no server defined]"
3:32PM ERR Failed to initialize: <nil> error="invalid configuration: [context was not found for specified context: test-cluster, cluster has no server defined]"
3:32PM INF Loaded ruleset name=deprecated-1-16.rego
3:32PM INF Loaded ruleset name=deprecated-1-22.rego

@stepanstipl
Copy link
Contributor

@san360 this should be resolved, would you be able to test latest master on windows to confirm?

stepanstipl added a commit that referenced this issue Sep 9, 2020
This covers previously discovered error when kubent would panic when it
fails to initialize the collector.

fixes #33, #25, #32
@stepanstipl stepanstipl mentioned this issue Sep 9, 2020
@stepanstipl
Copy link
Contributor

I believe this has been resolved, as per above, and covered by tests as well. Closing this issue. In case you experience the same again please comment and we can reopen.

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

No branches or pull requests

3 participants