I’ve run into a problem with the Go SDK for AWS. I...
# golang
s
I’ve run into a problem with the Go SDK for AWS. I have code that creates a VPC, public and private subnets, route tables, Internet gateway, etc. It also allocates an EIP for a NAT gateway (for the private subnets). If I run
pulumi preview
I get this:
Copy code
panic: sync: WaitGroup is reused before previous Wait has returned
    goroutine 1 [running]:
    sync.(*WaitGroup).Wait(0xc000386258)
    	/usr/local/go/src/sync/waitgroup.go:132 +0xae
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).wait|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).wait>(0xc000386140, 0x0, 0x0)
    	/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/context.go:156 +0x50
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunWithContext(0xc000386140|github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunWithContext(0xc000386140>, 0x1c3a4c8, 0xc0000440ef, 0xc)
    	/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:112 +0x2a6
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunErr(0x1c3a4c8|github.com/pulumi/pulumi/sdk/v3/go/pulumi.RunErr(0x1c3a4c8>, 0x0, 0x0, 0x0, 0x0, 0x0)
    	/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:84 +0x23f
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.Run(0x1c3a4c8|github.com/pulumi/pulumi/sdk/v3/go/pulumi.Run(0x1c3a4c8>, 0x0, 0x0, 0x0)
    	/Users/slowe/Code/Go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.4.0/go/pulumi/run.go:41 +0x59
    main.main()
    	/Users/slowe/Code/Repos/lab/infra/aws-infra-go/main.go:14 +0x3e
    exit status 2

    error: an unhandled error occurred: program exited with non-zero exit code: 1
If I comment out the NAT gateway code (which consumes the EIP), then the error goes away. This worked in previous versions of the SDK. I can share my code upon request, in the event that I’m doing something incorrectly.
The resolution is to use
pulumi.DependsOn
to add an explicit dependency on the Elastic IP. I don’t know if this is an expected change from previous versions of the SDK, or if this reflects a potential error/bug in the SDK.
b
Can you share your code?
s
@billowy-army-68599 Yes, I’ll upload it shortly.
It would seem that
pulumi.DependsOn
isn’t necessarily the fix; the error just occurred again.
Here’s my code.
Updating to the latest version of the AWS provider didn’t help. Nor did updating my
go.mod
to
go 1.16
(this is on an ARM64 M1-based Mac).
The error is intermittent; sometimes it happens and sometimes it doesn’t. I haven’t yet found a way to reliably reproduce it.
It would appear this is related: https://github.com/pulumi/pulumi/issues/7275