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 when acting upon powered off VM #88

Closed
hashibot opened this issue Jun 13, 2017 · 1 comment
Closed

Crash when acting upon powered off VM #88

hashibot opened this issue Jun 13, 2017 · 1 comment
Labels
crash Impact: Crash

Comments

@hashibot
Copy link

This issue was originally opened by @bpoland as hashicorp/terraform#13803. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform Version

Terraform version: 0.9.3 1601af7a076fd03fe940455db7fd01dfa747c795

Affected Resource(s)

vsphere_virtual_machine

Terraform Configuration Files

provider "vsphere" {
  user                 = "${var.vsphere_user}"
  password             = "${var.vsphere_password}"
  vsphere_server       = "${var.vsphere_server}"
  allow_unverified_ssl = "${var.vsphere_allow_unverified_ssl}"
}

resource "vsphere_virtual_machine" "dest_image" {
  name         = "${var.vsphere_dest_image_name}"
  folder       = "${var.vsphere_root_folder}/${var.vsphere_dest_image_folder}"
  vcpu         = "${var.vsphere_dest_image_vcpu}"
  memory       = "${var.vsphere_dest_image_memory}"
  domain       = "${var.vsphere_dest_image_domain}"
  datacenter   = "${var.vsphere_datacenter}"
  cluster      = "${var.vsphere_cluster}"
  dns_suffixes = ["${var.vsphere_dest_image_domain}"]
  dns_servers  = ["${var.vsphere_dns_servers}"]

  network_interface {
    label = "${var.vsphere_network}"
  }

  disk {
    datastore = "${var.vsphere_datastore}"
    template  = "${var.vsphere_root_folder}/${var.vsphere_source_image_folder}/${var.vsphere_source_image_name}"
  }
  
  connection {
    type = "ssh"
    user = "${var.vsphere_image_username}"
    password = "${var.vsphere_image_password}"
  }
}

Debug Output

I believe it's in the panic output below, here is the regular output:

$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

vsphere_virtual_machine.dest_image: Refreshing state... (ID: bp-vm-01)
Error refreshing state: 1 error(s) occurred:

  • vsphere_virtual_machine.dest_image: vsphere_virtual_machine.dest_image: unexpected EOF
    panic: runtime error: invalid memory address or nil pointer dereference
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x3cdc5c9]
    2017/04/20 10:32:49 [DEBUG] plugin: terraform:
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: goroutine 47 [running]:
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/vsphere.resourceVSphereVirtualMachineRead(0xc42023a380, 0x4daa380, 0xc4204ef650, 0x1, 0x77c2d80)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/vsphere/resource_vsphere_virtual_machine.go:1030 +0x18a9
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc420421d40, 0xc4201a0410, 0x4daa380, 0xc4204ef650, 0xc42043fd10, 0xc42042d301, 0x0)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:314 +0x21d
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc42026b1f0, 0xc4201a03c0, 0xc4201a0410, 0x7f42dc212000, 0x0, 0x0)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:267 +0x91
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc4200af140, 0xc4203f2060, 0xc4203f2c90, 0x0, 0x0)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: reflect.Value.call(0xc42035d920, 0xc42000c5a0, 0x13, 0x4e8780f, 0x4, 0xc4206c6f20, 0x3, 0x3, 0x0, 0x0, ...)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/go/src/reflect/value.go:434 +0x91f
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: reflect.Value.Call(0xc42035d920, 0xc42000c5a0, 0x13, 0xc420643f20, 0x3, 0x3, 0x0, 0x0, 0x0)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/go/src/reflect/value.go:302 +0xa4
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: net/rpc.(*service).call(0xc4204dcf40, 0xc4204dcf00, 0xc4201450f8, 0xc420521300, 0xc420434860, 0x4078040, 0xc4203f2060, 0x16, 0x4078080, 0xc4203f2c90, ...)
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/go/src/net/rpc/server.go:387 +0x144
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: created by net/rpc.(*Server).ServeCodec
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: /opt/go/src/net/rpc/server.go:481 +0x404
    2017/04/20 10:32:49 [ERROR] root: eval: *terraform.EvalRefresh, err: vsphere_virtual_machine.dest_image: unexpected EOF
    2017/04/20 10:32:49 [ERROR] root: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.dest_image: unexpected EOF
    2017/04/20 10:32:49 [TRACE] [walkRefresh] Exiting eval tree: vsphere_virtual_machine.dest_image
    2017/04/20 10:32:49 [DEBUG] dag/walk: upstream errored, not walking "output.dest_image_ip"
    2017/04/20 10:32:49 [DEBUG] dag/walk: upstream errored, not walking "root"
    2017/04/20 10:32:49 [DEBUG] plugin: waiting for all plugin processes to complete...
    2017/04/20 10:32:49 [WARN] plugin: error closing client during Kill: connection is shut down
    2017/04/20 10:32:49 [DEBUG] plugin: terraform: plugin process exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform1 so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Panic Output

https://gist.github.com/bpoland/5c9055b1c64e82654e5d928609d2cda3

Expected Behavior

Shouldn't crash. Should refresh successfully since the VM still exists it's just powered off.

Actual Behavior

Terraform crashed

Steps to Reproduce

  1. terraform refresh

Important Factoids

Only seems to happen if the VM has been sitting there for a while. A newly created and shut down VM does not have this issue

References

Seems potentially related to this: hashicorp/terraform#4302

@vancluever
Copy link
Contributor

Hello!

Looking at the crash logs, and judging from the nature of the issue, I think this should be fixed now that #129 has been merged. If there is anyone watching this issue that has the capabilities to build a custom provider binary can give it a go, that'd be great.

If course, if this does not fix this issue specifically, please open a new issue and reference this one.

Thanks again and sorry for the delays!

@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crash Impact: Crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants