Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Null pointer dereference crashΒ #484

@hsychla

Description

@hsychla




Describe the bug

K9s crashes when trying to list a cluster's nodes:
Boom!! runtime error: invalid memory address or nil pointer dereference.

It works on other clusters. The cluster on which it is crashing has one broken master with status NotReady,SchedulingDisabled but I have no idea if that is the actual issue.

To Reproduce
Steps to reproduce the behavior:

  1. Connect to cluster
  2. Enter :no
  3. See error

Expected behavior
List cluster's nodes.

Versions (please complete the following information):

  • OS: Win10 / WSL
  • K9s: 0.11.3
  • K8s: v1.10.8

Additional context

Bottom of debug log from k9s -l debug --context <cluster> -c no

3:44PM DBG RECONCILE "-":"v1/nodes" elapsed 841.8571ms
3:44PM ERR Boom! runtime error: invalid memory address or nil pointer dereference
3:44PM ERR goroutine 1 [running]:
runtime/debug.Stack(0x2c0c6a0, 0x1b37e03, 0x0)
        /usr/local/Cellar/go/1.13.5/libexec/src/runtime/debug/stack.go:24 +0x9d
github.com/derailed/k9s/cmd.run.func1()
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/cmd/root.go:73 +0x11d
panic(0x1911820, 0x2bdb4b0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/dao/node.go:51 +0x35f
github.com/derailed/k9s/internal/model.(*Table).list(0xc0008303c0, 0x1df3ec0, 0xc000a70240, 0x1df4380, 0xc0006f45a0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/table.go:211 +0x20d
github.com/derailed/k9s/internal/model.(*Table).reconcile(0xc0008303c0, 0x1df3ec0, 0xc000a70240, 0x0, 0x0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/table.go:220 +0x112
github.com/derailed/k9s/internal/model.(*Table).refresh(0xc0008303c0, 0x1df3ec0, 0xc000a70240)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/table.go:192 +0xba
github.com/derailed/k9s/internal/model.(*Table).Refresh(...)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/table.go:131
github.com/derailed/k9s/internal/model.(*Table).Watch(0xc0008303c0, 0x1df3ec0, 0xc000a70240)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/table.go:70 +0x3f
github.com/derailed/k9s/internal/view.(*Browser).Start(0xc0005e70a0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/browser.go:100 +0x169
github.com/derailed/k9s/internal/view.(*PageStack).StackPushed(0xc0000a9ac0, 0x7f9355be6d30, 0xc0008b0340)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/page_stack.go:36 +0x35
github.com/derailed/k9s/internal/model.(*Stack).notify(0xc00089c510, 0x1, 0x7f9355be6d30, 0xc0008b0340)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/stack.go:161 +0x101
github.com/derailed/k9s/internal/model.(*Stack).Push(0xc00089c510, 0x7f9355be6d30, 0xc0008b0340)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/model/stack.go:97 +0xa3
github.com/derailed/k9s/internal/view.(*App).inject(0xc000281540, 0x7f9355be6d30, 0xc0008b0340, 0x1b, 0xc00027c420)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/app.go:434 +0x1ba
github.com/derailed/k9s/internal/view.(*Command).exec(0xc000262060, 0xc0008972d0, 0x8, 0x7f9355be6d30, 0xc0008b0340, 0xc0008b0301, 0x0, 0x0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/command.go:166 +0x380
github.com/derailed/k9s/internal/view.(*Command).run(0xc000262060, 0x7fffc86d6215, 0x2, 0x1, 0xc000000180, 0x16ce402)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/command.go:72 +0x40f
github.com/derailed/k9s/internal/view.(*Command).defaultCmd(0xc000262060, 0x1bfd348, 0xc000281540)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/command.go:87 +0x48
github.com/derailed/k9s/internal/view.(*App).Run(0xc000281540)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/internal/view/app.go:303 +0x127
github.com/derailed/k9s/cmd.run(0x2bedd60, 0xc0000c0600, 0x0, 0x6)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/cmd/root.go:88 +0x145
github.com/spf13/cobra.(*Command).execute(0x2bedd60, 0xc0000c4010, 0x6, 0x6, 0x2bedd60, 0xc0000c4010)
        /Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x2bedd60, 0x0, 0x0, 0x0)
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/cmd/root.go:88 +0x145
github.com/spf13/cobra.(*Command).execute(0x2bedd60, 0xc0000c4010, 0x6, 0x6, 0x2bedd60, 0xc0000c4010)
        /Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x2bedd60, 0x0, 0x0, 0x0)
        /Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/derailed/k9s/cmd.Execute()
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/cmd/root.go:63 +0x2d
main.main()
        /Users/fernand/go_wk/derailed/src/github.com/derailed/k9s/main.go:25 +0x1a6```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions