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

invalid memory address or nil pointer dereference with kubernetes v1.27.0 #2055

Closed
SammyA opened this issue Apr 12, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@SammyA
Copy link
Contributor

SammyA commented Apr 12, 2023




Describe the bug
On a cluster i just upgraded to v1.27.0 k9s crashes at startup with the following message:

Boom!! runtime error: invalid memory address or nil pointer dereference.

This does not happen on all v1.27.0 clusters. For example: a clean installed new v1.27.0 cluster works fine. I'm suspecting k9s chokes on some installed custom resource.

I tried building k9s from source, and with k8s.io/client-go@v0.27.0 it seems to work OK.

To Reproduce

  1. Get a nicely worn in cluster, with lots of custom resources, upgraded to v1.27.0
  2. Connect with k9s
  3. Boom!!

Expected behavior
no Boom!!

Versions (please complete the following information):

  • OS: Debian/GNU Linux Bullseye
  • K9s: v0.27.3
  • K8s: v1.27.0

Additional context
Stack trace from the log:

3:31PM INF 🐶 K9s starting up...
3:31PM ERR Boom! runtime error: invalid memory address or nil pointer dereference
3:31PM ERR goroutine 1 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/derailed/k9s/cmd.run.func2()
        github.com/derailed/k9s/cmd/root.go:72 +0xb1
panic({0x2147140, 0x3bf32c0})
        runtime/panic.go:884 +0x212
k8s.io/client-go/discovery.convertAPIResource(...)
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:88
k8s.io/client-go/discovery.convertAPIGroup({{{0x0, 0x0}, {0x0, 0x0}}, {{0xc00049df38, 0x15}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:69 +0x5f0
k8s.io/client-go/discovery.SplitGroupsAndResources({{{0xc00049c540, 0x15}, {0xc000b84800, 0x1b}}, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:35 +0x2f8
k8s.io/client-go/discovery.(*DiscoveryClient).downloadAPIs(0xc000c3e1e0?)
        k8s.io/client-go@v0.26.1/discovery/discovery_client.go:310 +0x47c
k8s.io/client-go/discovery.(*DiscoveryClient).GroupsAndMaybeResources(0x0?)
        k8s.io/client-go@v0.26.1/discovery/discovery_client.go:198 +0x5c
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).refreshLocked(0xc000400ae0)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:222 +0x57
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).GroupsAndMaybeResources(0xc000400ae0)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:128 +0xc5
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).ServerGroups(0xc0003a96d0?)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:148 +0x19
k8s.io/client-go/discovery/cached/disk.(*CachedDiscoveryClient).ServerGroups(0xc0003a96d0)
        k8s.io/client-go@v0.26.1/discovery/cached/disk/cached_discovery.go:118 +0x172
github.com/derailed/k9s/internal/client.(*APIClient).supportsMetricsResources(0xc0001ce690)
        github.com/derailed/k9s/internal/client/client.go:454 +0x16f
github.com/derailed/k9s/internal/client.InitConnection(0xc000164700)
        github.com/derailed/k9s/internal/client/client.go:64 +0x135
github.com/derailed/k9s/cmd.loadConfiguration()
        github.com/derailed/k9s/cmd/root.go:122 +0x5e7
github.com/derailed/k9s/cmd.run(0x3c0b080?, {0x2478bfb?, 0x7?, 0x7?})
        github.com/derailed/k9s/cmd/root.go:82 +0x2e6
github.com/spf13/cobra.(*Command).execute(0x3c0b080, {0xc0001b6010, 0x7, 0x7})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x3c0b080)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/derailed/k9s/cmd.Execute()
        github.com/derailed/k9s/cmd/root.go:50 +0x25
main.main()
        github.com/derailed/k9s/main.go:29 +0x17
@derailed
Copy link
Owner

@SammyA Dang! Thank you for reporting this!
It does look like a k8s issue. Good to know updating the client seems to fix this.
Will rev up the k8s deps on the next drop.

@derailed derailed added the bug Something isn't working label Apr 13, 2023
SammyA referenced this issue in kubernetes/client-go Apr 13, 2023
Kubernetes-commit: 26bf8a7ceb51bac357d8a02fd3e62b84363716db
@SammyA
Copy link
Contributor Author

SammyA commented May 5, 2023

Looks like the fix from client-go v0.27.x was backported to v0.26.4 : kubernetes/kubernetes#116666 . So that would also fix it if you're not ready to upgrade to v0.27.x yet.

@SammyA
Copy link
Contributor Author

SammyA commented May 9, 2023

v0.27.4 works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants