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 when diffing an invalid kubeconfig #1543

Closed
rraval opened this issue Apr 25, 2021 · 1 comment · Fixed by #1581
Closed

Panic when diffing an invalid kubeconfig #1543

rraval opened this issue Apr 25, 2021 · 1 comment · Fixed by #1581
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@rraval
Copy link

rraval commented Apr 25, 2021

A mixture of 2 space indents in YAML and 4 space indents in Typescript caused my editor to malform the kubeconfig during unrelated refactoring.

This causes pulumi up to panic when computing the diff: ~kubeconfig

Expected behavior

Some reasonable error reporting instead of process crash.

Current behavior

pulumi up crashes with:

  pulumi:pulumi:Stack (pulumi-kubernetes-segfault-dev):
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1d21d22]
    goroutine 29 [running]:
    github.com/pulumi/pulumi-kubernetes/provider/v3/pkg/provider.getActiveClusterFromConfig(0xc0004a86c0, 0xc00024ad20, 0xc000697380)
    	/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/util.go:118 +0xe2
    github.com/pulumi/pulumi-kubernetes/provider/v3/pkg/provider.(*kubeProvider).DiffConfig(0xc0009a7a40, 0x2507808, 0xc00024ac00, 0xc0001e8000, 0xc0009a7a40, 0x1f0d501, 0xc000834180)
    	/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:345 +0xcb8
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_DiffConfig_Handler.func1(0x2507808, 0xc00024ac00, 0x20b3780, 0xc0001e8000, 0x20c8ca0, 0x3561868, 0x2507808, 0xc00024ac00)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.0.0/proto/go/provider.pb.go:2158 +0x89
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x2507808, 0xc000120ab0, 0x20b3780, 0xc0001e8000, 0xc00013e0c0, 0xc0004020d8, 0x0, 0x0, 0x24c19e0, 0xc00007d790)
    	/home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x30a
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_DiffConfig_Handler(0x214f4a0, 0xc0009a7a40, 0x2507808, 0xc000120ab0, 0xc0004a84e0, 0xc000622d80, 0x2507808, 0xc000120ab0, 0xc000577300, 0x127a)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.0.0/proto/go/provider.pb.go:2160 +0x150
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc00079ce00, 0x25235b8, 0xc000582600, 0xc000538100, 0xc00070de60, 0x34ff1d0, 0x0, 0x0, 0x0)
    	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:1210 +0x52b
    google.golang.org/grpc.(*Server).handleStream(0xc00079ce00, 0x25235b8, 0xc000582600, 0xc000538100, 0x0)
    	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:1533 +0xd0c
    google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000532080, 0xc00079ce00, 0x25235b8, 0xc000582600, 0xc000538100)
    	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:871 +0xab
    created by google.golang.org/grpc.(*Server).serveStreams.func1
    	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:869 +0x1fd

Steps to reproduce

I've minimized the problem: https://github.com/rraval/pulumi-kubernetes-segfault

  1. Check out the initial commit: index.ts.
  2. Run pulumi up with no issues.
  3. Move to the second commit: index.ts, Diff. This commit corrupts the indentation of kubeconfig, making it invalid.
  4. Run pulumi up again, see panic from above.

Context (Environment)

Refactoring some code to move the provider creation from top level into a function (hence the change in indentation).

Affected feature

@rraval rraval added the kind/bug Some behavior is incorrect or out of spec label Apr 25, 2021
@komalali komalali added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels Apr 27, 2021
@infin8x infin8x added the p1 A bug severe enough to be the next item assigned to an engineer label May 18, 2021
@infin8x infin8x added this to the 0.57 milestone May 18, 2021
@lblackstone
Copy link
Member

Thanks for the detailed repro! I tracked down the panic and have a PR open to fix that should go out with tomorrow's release.

@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants