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

Crash report #5963

Closed
ghost opened this issue Sep 24, 2018 · 4 comments · Fixed by #5968
Closed

Crash report #5963

ghost opened this issue Sep 24, 2018 · 4 comments · Fixed by #5968
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@ghost
Copy link

ghost commented Sep 24, 2018

This issue was originally opened by @bennettp123 as hashicorp/terraform#18917. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.8
+ provider.aws v1.36.0

(Also reproduced in v0.11.7, but the crash and trace logs provided below are from v0.11.8).

Terraform Configuration Files

data "aws_ami" "soe" {
  owners      = ["self"]
  most_recent = true

  filter {
    name   = "name"
    values = ["centos-7-x86_64-*"]
  }

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  }
}

Debug Output

https://gist.github.com/bennettp123/c2760fc5e0ff230431fcc08b96e97900#file-trace-log-enc

Crash Output

https://gist.github.com/bennettp123/7645f4c4a9f2b7c84b777e969f454297#file-crash-log-enc

Expected Behavior

Does not crash.

Actual Behavior

Crashes with crash.log and trace output attached

Steps to Reproduce

  1. terraform init
  2. terraform apply -out=.tfplan

Additional Context

References

@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service. labels Sep 24, 2018
@bflad bflad self-assigned this Sep 24, 2018
@bflad
Copy link
Contributor

bflad commented Sep 24, 2018

Relevant portion of crash.log (no confidential data):

2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1d39056]
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.amiBlockDeviceMappings(0xc00017cef8, 0x1, 0x1, 0x2602bc0)
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_ami.go:350 +0x386
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.amiDescriptionAttributes(0xc0003e17a0, 0xc0010b6000, 0xc000ed79b8, 0x1)
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_ami.go:322 +0x45a
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.dataSourceAwsAmiRead(0xc0003e17a0, 0x2a51c80, 0xc000234300, 0xc0003e17a0, 0x0)
2018-09-21T08:22:41.685+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_ami.go:275 +0x87b

Stripped DescribeImagesResponse item likely causing the issue:

2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: 2018/09/21 08:22:41 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4: <DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:     <requestId>--OMITTED--</requestId>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:     <imagesSet>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:         <item>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <imageId>--OMITTED--</imageId>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <imageLocation>--OMITTED--</imageLocation>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <imageState>failed</imageState>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <imageOwnerId>--OMITTED--</imageOwnerId>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <creationDate>2018-09-20T23:47:22.000Z</creationDate>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <isPublic>false</isPublic>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <architecture>x86_64</architecture>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <imageType>machine</imageType>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <sriovNetSupport>simple</sriovNetSupport>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <stateReason>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                 <code>Client.SnapshotLimitExceeded</code>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                 <message>Client.SnapshotLimitExceeded</message>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             </stateReason>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <name>--OMITTED--</name>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <rootDeviceType>ebs</rootDeviceType>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <rootDeviceName>/dev/sda1</rootDeviceName>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <blockDeviceMapping>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                 <item>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                     <deviceName>/dev/sda1</deviceName>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                     <ebs>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                         <deleteOnTermination>false</deleteOnTermination>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                         <volumeType>standard</volumeType>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                         <encrypted>false</encrypted>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                     </ebs>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:                 </item>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             </blockDeviceMapping>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <virtualizationType>hvm</virtualizationType>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <hypervisor>xen</hypervisor>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:             <enaSupport>true</enaSupport>
2018-09-21T08:22:41.672+0800 [DEBUG] plugin.terraform-provider-aws_v1.36.0_x4:         </item>

The fix for the panic itself is straightforward (its always expecting blockDeviceMapping ebs volumeSize to exist), although it seems we might want to also support automatic filtering on imageState by default to omit failed AMIs. 🤔 I'll submit a patch for the panic and we can think about potentially dealing with the second case later in a separate issue.

@bflad
Copy link
Contributor

bflad commented Sep 24, 2018

The fix to prevent panics when the AMI state is failed has been merged into master and will release with version 1.38.0 of the AWS provider, likely middle of this week.

@bflad
Copy link
Contributor

bflad commented Sep 26, 2018

This has been released in version 1.38.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link
Author

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant