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

Assignment to entry in nil map error when shell to default container #2585

Closed
Shaokun-X opened this issue Mar 4, 2024 · 1 comment · Fixed by #2586
Closed

Assignment to entry in nil map error when shell to default container #2585

Shaokun-X opened this issue Mar 4, 2024 · 1 comment · Fixed by #2586

Comments

@Shaokun-X
Copy link




Describe the bug
When I tried to shell connect to the default container of a pod, that is, on the Pods page pressing "S", the program crashed. This seems new after upgrading to v3.20.0.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Pods' page
  2. Select a pod that has multiple containers (singular container works fine)
  3. Press on 'S'
  4. See error

Historical Documents
Error log:

ERR Boom! assignment to entry in nil map
ERR goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x5e
github.com/derailed/k9s/cmd.run.func2()
	github.com/derailed/k9s/cmd/root.go:97 +0xb1
panic({0x10ff6c580?, 0x1104c7f10?})
	runtime/panic.go:770 +0x132
github.com/derailed/tview.(*Application).Run.func1()
	github.com/derailed/tview@v0.8.3/application.go:243 +0x45
panic({0x10ff6c580?, 0x1104c7f10?})
	runtime/panic.go:770 +0x132
github.com/derailed/k9s/internal/ui.(*KeyActions).Add(0xc0080d5d48, 0x1b, {{0x10eeca7fe, 0x4}, 0xc0080f8690, {0x1, 0x0, 0x0, 0x0, 0x0}})
	github.com/derailed/k9s/internal/ui/action.go:127 +0x85
github.com/derailed/k9s/internal/view.(*Picker).Init(0xc0080d5d40, {0x1105064e8?, 0xc0080d5e00?})
	github.com/derailed/k9s/internal/view/picker.go:41 +0x177
github.com/derailed/k9s/internal/view.(*App).inject(0xc000efc000, {0x1105271c0, 0xc0080d5d40}, 0x0)
	github.com/derailed/k9s/internal/view/app.go:717 +0x77
github.com/derailed/k9s/internal/view.containerShellin(0xc000efc000, {0x110527268, 0xc001f13610}, {0xc006d00780, 0x27}, {0x0?, 0x1000000000018?})
	github.com/derailed/k9s/internal/view/pod.go:393 +0x3e5
github.com/derailed/k9s/internal/view.(*Pod).shellCmd(0xc001f13610, 0xc000018bc0)
	github.com/derailed/k9s/internal/view/pod.go:252 +0xc8
github.com/derailed/k9s/internal/view.(*Table).keyboard(0xc003be6700, 0xc000018bc0)
	github.com/derailed/k9s/internal/view/table.go:97 +0x129
github.com/derailed/k9s/internal/view.(*Browser).InputHandler.(*Table).InputHandler.(*Box).WrapInputHandler.func2(0x10c3596e5?, 0xc0049d0360)
	github.com/derailed/tview@v0.8.3/box.go:179 +0x37
github.com/derailed/k9s/internal/view.(*PageStack).InputHandler.(*Pages).InputHandler.func1(0xc000018bc0, 0xc0049d0360)
	github.com/derailed/tview@v0.8.3/pages.go:332 +0xa2
github.com/derailed/k9s/internal/view.(*PageStack).InputHandler.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc002d6f7d0?, 0x10c3596e5?)
	github.com/derailed/tview@v0.8.3/box.go:182 +0x50
github.com/derailed/tview.(*Flex).InputHandler.func1(0xc000018bc0, 0xc0049d0360)
	github.com/derailed/tview@v0.8.3/flex.go:261 +0xd7
github.com/derailed/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc000bb98c0?, 0xc0012de008?)
	github.com/derailed/tview@v0.8.3/box.go:182 +0x50
github.com/derailed/k9s/internal/ui.(*Pages).InputHandler.(*Pages).InputHandler.func1(0xc000018bc0, 0xc0049d0360)
	github.com/derailed/tview@v0.8.3/pages.go:332 +0xa2
github.com/derailed/k9s/internal/ui.(*Pages).InputHandler.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc002d6f948?, 0xc002d6f8b0?)
	github.com/derailed/tview@v0.8.3/box.go:182 +0x50
github.com/derailed/tview.(*Application).Run(0xc00024bdc0)
	github.com/derailed/tview@v0.8.3/application.go:334 +0x518
github.com/derailed/k9s/internal/view.(*App).Run(0xc000efc000)
	github.com/derailed/k9s/internal/view/app.go:551 +0x8f
github.com/derailed/k9s/cmd.run(0xc000dabd00?, {0x10eeca726?, 0x4?, 0x10eeca63a?})
	github.com/derailed/k9s/cmd/root.go:115 +0x3a5
github.com/spf13/cobra.(*Command).execute(0x1122a2260, {0xc000052180, 0x0, 0x0})
	github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x1122a2260)
	github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/derailed/k9s/cmd.Execute()
	github.com/derailed/k9s/cmd/root.go:70 +0x1a
main.main()
	github.com/derailed/k9s/main.go:32 +0xf

Expected behavior
k9s selects the default container and establish a shell to it.

Screenshots
Not applicable

Versions (please complete the following information):

  • OS: macOS 14.3.1 23D60 x86_64
  • K9s: v0.32.0
  • K8s: v1.26.12-eks-5e0fdde

Additional context
If I remember correctly, in 3.19.x or before versions there was no such bug.

@lightme16
Copy link

Same for me, just installed k9s via a brew and got this errors while trying to enter shell.

Version: v0.32.0
Commit: 0d16531
Date: 2024-03-02T17:20:41Z

nobbs added a commit to nobbs/k9s that referenced this issue Mar 4, 2024
This commit fixes a bug introcuded in v0.32.0 where the shell-in and
attach commands would fail with a nil pointer exception for pods with
more than one container.

Resolves derailed#2585
derailed added a commit that referenced this issue Mar 5, 2024
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.

2 participants