<@UQ8K13T7X> Sure, let me start a thread here with...
# golang
s
@lemon-agent-27707 Sure, let me start a thread here with some additional information.
I followed the instructions in the
README.md
in that directory, and when I run
pulumi preview
I get this:
Copy code
Previewing update (dev):
     Type                 Name         Plan     Info
     pulumi:pulumi:Stack  gotest2-dev           1 error; 224 messages
 pile/
Diagnostics:
  pulumi:pulumi:Stack (gotest2-dev):
    error: an unhandled error occurred: program exited with non-zero exit code: 2
 
    # <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>
    fatal error: runtime: out of memory
    runtime stack:
(I omitted many lines of output; if you want them, let me know.)
I also tried some hand-written code based on examples from other websites:
Copy code
package main

import (
	"fmt"
	"<http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>"
	"<http://github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2>"
	"<http://github.com/pulumi/pulumi-aws/sdk/v2/go/aws|github.com/pulumi/pulumi-aws/sdk/v2/go/aws>"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {

		// Define some values for later
		// baseName := "custdns"
		// keyPair := "aws_vmw_rsa"

		// Build the arguments for creating the VPC
		vpcArgs := &ec2.vpcArgs{
			CidrBlock: pulumi.String("10.52.0.0/16"),
		}

		// Create the VPC
		vpc, err := ec2.NewVpc(ctx, "custdns-vpc", vpcArgs)
		if err != nil {
			fmt.Println(err.Error())
			return err
		}

		// Export the VPC ID
		ctx.Export("VPC ID", vpc.ID())
		return nil
	})
}
Very similar error when I run
pulumi preview
with that code:
Copy code
Previewing update (dev):
     Type                 Name        Plan     Info
     pulumi:pulumi:Stack  gotest-dev           1 error; 223 messages
 
Diagnostics:
  pulumi:pulumi:Stack (gotest-dev):
    # <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>
    fatal error: runtime: out of memory
    runtime stack:
(Again, many lines of output omitted.)
This is using Pulumi 2.4.0 on Debian 10 (kernel 4.19) with Go 1.13.
BTW, I get a similar error when using
pulumi up
instead of
pulumi preview
, FWIW.
l
Yes, sharing the error output would be helpful.
also can you run
pulumi plugin ls
so we can check the version of the AWS provider plugin?
s
Here's the full output, including all the error text.
l
I just tried the example with pulumi 2.4.0, pulumi aws plugin 2.7.0 and go 1.14.2 and was able to get this example to run successfully with a
pulumi preview
. Definitely sounds like there's something up here. I don't think I've seen that out of memory exception. I'd definitely like to look into this.
s
And here's the output of `pulumi plugin ls`:
Copy code
NAME    KIND      VERSION  SIZE    INSTALLED  LAST USED
aws     resource  2.9.1    222 MB  n/a        18 hours ago
aws     resource  2.0.0    224 MB  n/a        15 hours ago
aws     resource  1.31.0   224 MB  n/a        18 hours ago
aws     resource  1.17.0   198 MB  n/a        18 hours ago
docker  resource  2.2.3    40 MB   n/a        26 minutes ago
Not sure if this matters, but in the interest of full transparency: I'm running the
pulumi
commands via an SSH session on a Debian VM running on KVM/Libvirt on my Fedora laptop.
l
The Go SDK is actually pretty large
s
So...increase RAM in the VM?
l
Can you try building a binary?
go build -o main
s
Tried that...also fails, with a similar error message (I can try again to get specifics if desired).
l
Ok, so if it fails to build that means pulumi hasn't even run at this point. This probably means that your VM doesn't have enough memory. What are the specs?
(the output binary is 103mb on my machine)
s
Single vCPU, 1GB of RAM (can be easily modified, of course)
l
Yeah, perhaps try 2GB? We generate a huge number of types to get around the lack of generics. Definitely something we want to improve.
s
OK, I'm building an Ubuntu 18.04 VM now on the off-chance that might make a difference. I'll update both VMs shortly and try again.
This is the output from trying
go build -o main
on the Debian VM with 2GB of RAM, Pulumi 2.4.0, AWS plugin 2.7.0, and Go 1.14.4 (all other AWS plugin versions removed).
l
Ouch, sorry that you're running into this. I wonder if this will happen independent of memory available, for instance if you try on an 8GB VM. I don't think we know what the minimum requirements for our Go SDK are at this time. Definitely something we need to document.
s
Interesting---after chewing through CPU for a while, the Ubuntu 18.04 VM w/ 2GB of RAM seemed like it was going to work with
pulumi up
(using the "aws-go-webserver" example). Let me "reset" the Debian VM and see what happens there.
l
By default Go programs use
go run
style of invocation, which may very well take up less memory than the explicit build step you were testing.
s
A "clean" Debian VM, with the same configuration as the Ubuntu VM that just worked, reports an error (same "out of memory" error) with the "aws-go-webserver" example. I'll try upping the RAM and see what happens.
👍 1
Upping the Debian VM to 4GB of RAM allowed a
pulumi up
to work (I didn't actually perform the update, but it didn't crash as it had earlier). It seems that I was just being too stingy with resources---thanks for your help troubleshooting.
The Ubuntu VM also seems to work at 4GB of RAM (no crash when running
pulumi up
), so perhaps it would be worthwhile to document that 4GB of RAM is the minimum recommended memory allocation?
l
Glad we were able to figure this out. Don't hesitate to reach out if you have any more problems. I've filed an issue so that the team can follow up on documenting system requirements https://github.com/pulumi/docs/issues/3643
s
Awesome, thanks