pulumi / pulumi-terraform-bridge

A library allowing providers built with the Terraform Plugin SDK to be bridged into Pulumi.
Apache License 2.0
183 stars 41 forks source link

Panic in muxer when attaching with PULUMI_DEBUG_PROVIDERS #2088

Closed guineveresaenger closed 1 week ago

guineveresaenger commented 2 weeks ago

What happened?

Following debug provider steps in p-aws, upon starting a program using PULUMI_DEBUG_PROVIDERS and the exposed port, the process crashes.

Example

Got a connection, launched process /Users/guin/go/src/github.com/pulumi/pulumi-aws/bin/pulumi-resource-aws (pid = 97357).
55429
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1059f7714]

goroutine 55 [running]:
github.com/pulumi/pulumi/pkg/v3/resource/provider.(*HostClient).Close(0x0)
        /Users/guin/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.119.0/resource/provider/host.go:62 +0x24
github.com/pulumi/pulumi-terraform-bridge/x/muxer.(*muxer).Attach(0x140038df3e0, {0x11c57f200, 0x14007632c30}, 0x1400764e240)
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/x/muxer/muxer.go:438 +0x250
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Attach_Handler.func1({0x11c57f200, 0x14007632c30}, {0x11b376520, 0x1400764e240})
        /Users/guin/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.119.0/proto/go/provider_grpc.pb.go:777 +0xbc
github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x11c57f200, 0x14007632c30}, {0x11b376520, 0x1400764e240}, 0x14007636180, 0x1400250a360)
        /Users/guin/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x574
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Attach_Handler({0x11c166b20, 0x140038df3e0}, {0x11c57f200, 0x140076329f0}, 0x14007634300, 0x14002f7efc0)
        /Users/guin/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.119.0/proto/go/provider_grpc.pb.go:779 +0x1e4
google.golang.org/grpc.(*Server).processUnaryRPC(0x14002f26200, {0x11c57f200, 0x14007632960}, {0x11c5cd440, 0x1400764c000}, 0x14007662120, 0x14003a84180, 0x125aeaa80, 0x0)
        /Users/guin/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0x13a4
google.golang.org/grpc.(*Server).handleStream(0x14002f26200, {0x11c5cd440, 0x1400764c000}, 0x14007662120)
        /Users/guin/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /Users/guin/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x144
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 53
        /Users/guin/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x1c8
Exiting.

Output of pulumi about

CLI          
Version      3.116.1
Go Version   go1.22.3
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  aws     6.39.1
resource  awsx    2.11.0
resource  docker  4.5.4
resource  docker  3.6.1
language  nodejs  unknown

Host     
OS       darwin
Version  13.5
Arch     arm64

This project is written in nodejs: executable='/opt/homebrew/bin/node' version='v21.6.0'

Current Stack: guinevere-pulumi-corp/bridge-2020/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/guinevere-pulumi-corp
User           guinevere-pulumi-corp
Organizations  guinevere-pulumi-corp, pulumi
Token type     personal

Dependencies:
NAME            VERSION
@pulumi/aws     6.39.1
@pulumi/awsx    2.11.0
@pulumi/pulumi  3.119.0
@types/node     18.19.34
typescript      5.4.5

Additional context

Prior attempt to fix: https://github.com/pulumi/pulumi-terraform-bridge/pull/1716

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).