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

"Could not load plugin" – regression between 2.2.1 and 2.3.0 #120

Closed
lukiffer opened this issue Sep 3, 2020 · 7 comments
Closed

"Could not load plugin" – regression between 2.2.1 and 2.3.0 #120

lukiffer opened this issue Sep 3, 2020 · 7 comments
Labels

Comments

@lukiffer
Copy link

lukiffer commented Sep 3, 2020

When using provider version 2.3.0, the provider plugin fails to load.

Error: Could not load plugin
...
Failed to retrieve schema from provider
"registry.terraform.io/hashicorp/random": rpc error: code = Unavailable desc =
connection closed

Terraform Version

Reproduced on both 0.12.29 and 0.13.2

Affected Resource(s)

It appears to be a provider issue (or potentially a plugin SDK issue) not related to a specific resource, but will use random_id for the sake of example.

Terraform Configuration Files

provider "random" {
  version = "2.3.0"
}

resource "random_id" "test" {
  byte_length = 8
}

output "test" {
  value = random_id.test.b64_std
}

Debug Output

https://gist.github.com/lukiffer/b9b86ccb0fb50b658b1d297d1e221f22

To highlight a specific set of outputs:

2020/09/03 03:51:19 [INFO] Go runtime version: go1.14.7
2020-09-03T03:51:19.508-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: plugin address: address=/var/folders/0s/bbgtj68j187fdpfggtzgqr8r0000gn/T/plugin077377841 network=unix timestamp=2020-09-03T03:51:19.508-0500
2020-09-03T03:51:19.508-0500 [DEBUG] plugin: using plugin: version=5
2020-09-03T03:51:19.606-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: SIGILL: illegal instruction
2020-09-03T03:51:19.606-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: PC=0x1063d90 m=0 sigcode=1
2020-09-03T03:51:19.606-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: goroutine 54 [running]:
2020-09-03T03:51:19.606-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: runtime.asyncPreempt()
2020-09-03T03:51:19.606-0500 [DEBUG] plugin.terraform-provider-random_v2.3.0_x4: 	/opt/goenv/versions/1.14.0/src/runtime/preempt_amd64.s:8 fp=0xc00056b1e8 sp=0xc00056b1e0 pc=0x1063d90

It appears that the go runtime is 1.14.7 but the provider was compiled against 1.14.0 – not typically an issue, but there was an issue with 1.14.0 not guarding a specific instruction or feature not available on some CPUs that was fixed in 1.14.1. (See golang/go#37478 and https://go-review.googlesource.com/c/go/+/221058/)

I believe all that should be required is that the plugin be compiled with go1.14.1 or later, but I haven't tested this.

Steps to Reproduce

  1. terraform init && terraform plan
@diegoaguilar
Copy link

@lukiffer did you figure out this?

@lukiffer
Copy link
Author

@diegoaguilar we're skirting this issue by pinning the provider version. Less than ideal but it works.

@kmoe
Copy link
Member

kmoe commented Oct 23, 2020

Interesting bug report, thank you.

I was unable to reproduce this with Go 1.14.7 on relatively new linux/amd64 or darwin/amd64 machines, and unfortunately I don't have a pre-AVX machine to hand to test this. However, if you can verify that building with Go 1.14.1 or later solves this problem for you, I'm happy to release a v2.3.1 of this provider compiled with Go >=1.14.1.

@kmoe kmoe added bug waiting-response Issues or pull requests waiting for an external response labels Oct 23, 2020
@lukiffer
Copy link
Author

@kmoe thanks, I'll try it out this weekend.

@ghost ghost removed the waiting-response Issues or pull requests waiting for an external response label Oct 23, 2020
@lukiffer
Copy link
Author

I built master locally using go 1.15.3 and it works on both a pre-AVX machine and a AVX2 machine:

Pre-AVX (Mid-2010 MacPro)

$ sysctl -n machdep.cpu.brand_string
Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz

$ go version
go version go1.14.7 darwin/amd64

$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # random_id.test will be created
  + resource "random_id" "test" {
      + b64_std     = (known after apply)
      + b64_url     = (known after apply)
      + byte_length = 8
      + dec         = (known after apply)
      + hex         = (known after apply)
      + id          = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

random_id.test: Creating...
random_id.test: Creation complete after 0s [id=SBCw_k6odGg]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

test = SBCw/k6odGg=

With AVX2 (Current MacBook Pro)

$ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz

$ go version
go version go1.15.3 darwin/amd64

$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # random_id.test will be created
  + resource "random_id" "test" {
      + b64_std     = (known after apply)
      + b64_url     = (known after apply)
      + byte_length = 8
      + dec         = (known after apply)
      + hex         = (known after apply)
      + id          = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

random_id.test: Creating...
random_id.test: Creation complete after 0s [id=w7FYRyhBo7U]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

test = w7FYRyhBo7U=

kmoe added a commit that referenced this issue Oct 26, 2020
@kmoe
Copy link
Member

kmoe commented Oct 26, 2020

v2.3.1 is released, which should fix this issue.

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants