Skip to content

Segfault when running headscale nodes list --output json when backend is not running. #652

Closed
@rcmcdonald91

Description

When running headscale nodes list --output json against a server that is offline, a segfault is encountered. headscale nodes list fails gracefully with Could not connect..... This segfault is problematic for frontends that consume json output exclusively.

$ headscale nodes list --output json
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb1feab]

goroutine 1 [running]:
google.golang.org/grpc.(*ClientConn).Close(0x0)
        google.golang.org/grpc@v1.46.0/clientconn.go:998 +0x4b
panic({0x1124f80, 0x1c52bc0})
        runtime/panic.go:838 +0x207
google.golang.org/grpc.(*ClientConn).Invoke(0x80203cf18?, {0x1464490?, 0xc00054ec60?}, {0x1292a76?, 0x0?}, {0x118afc0?, 0xc00054c040?}, {0x118b080?, 0xc00054c180?}, {0x0, ...})
        google.golang.org/grpc@v1.46.0/call.go:32 +0x5e
github.com/juanfont/headscale/gen/go/headscale/v1.(*headscaleServiceClient).ListMachines(0xc00007a780, {0x1464490, 0xc00054ec60}, 0xc0002f4420?, {0x0, 0x0, 0x0})
        github.com/juanfont/headscale/gen/go/headscale/v1/headscale_grpc.pb.go:195 +0xce
github.com/juanfont/headscale/cmd/headscale/cli.glob..func16(0x1c666e0?, {0x125c23c?, 0x2?, 0x2?})
        github.com/juanfont/headscale/cmd/headscale/cli/nodes.go:168 +0x2d0
github.com/spf13/cobra.(*Command).execute(0x1c666e0, {0xc000550980, 0x2, 0x2})
        github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1c68260)
        github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.4.0/command.go:902
github.com/juanfont/headscale/cmd/headscale/cli.Execute()
        github.com/juanfont/headscale/cmd/headscale/cli/root.go:85 +0x25
main.main()
        github.com/juanfont/headscale/cmd/headscale/headscale.go:42 +0x235

To Reproduce

  1. Invoke headscale with --output json against a backend that is not running.

Context info

  • Version of headscale used: v0.16.0-beta4 (and v0.15.0)
  • Version of tailscale client: N/A
  • OS (e.g. Linux, Mac, Cygwin, WSL, etc.) and version: FreeBSD 13.1-RELEASE

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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