jfrog/terraform-provider-artifactory

Plugin crashes after the upgrade to 10.5.0

tomaskissik opened this issue · 8 comments

After the upgrade of provider to version 10.5.0
the plugin crashes, v 10.4.3 works without issues the log:

Error: Plugin did not respond

The plugin encountered an error, and failed to respond to the
plugin6.(*GRPCProvider).ValidateDataResourceConfig call. The plugin logs may
contain more details.

Error: Request cancelled

The plugin6.(*GRPCProvider).ValidateDataResourceConfig request was cancelled.

Error: Plugin did not respond

The plugin encountered an error, and failed to respond to the
plugin6.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more
details.

Error: Request cancelled

The plugin6.(*GRPCProvider).ValidateDataResourceConfig request was cancelled.

Stack trace from the terraform-provider-artifactory_v10.5.0 plugin:

panic: interface conversion: interface {} is nil, not util.ProvderMetadata

goroutine 164 [running]:
github.com/jfrog/terraform-provider-shared/util/sdk.AddTelemetry.applyTelemetry.func2({0x114c9f0?, 0xc0002c2770}, 0x0?, {0x0?, 0x0})
  github.com/jfrog/terraform-provider-shared@v1.22.4/util/sdk/sdk.go:186 +0x285
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0004bafc0, {0x114c948, 0xc000362540}, 0xd?, {0x0, 0x0})
  github.com/hashicorp/terraform-plugin-sdk/v2@v2.30.0/helper/schema/resource.go:795 +0x11b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0004bafc0, {0x114c948, 0xc000362540}, 0xc000505000, {0x0, 0x0})
  github.com/hashicorp/terraform-plugin-sdk/v2@v2.30.0/helper/schema/resource.go:1015 +0x149
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc000010660, {0x114c948?, 0xc0003620f0?}, 0xc000d80600)
  github.com/hashicorp/terraform-plugin-sdk/v2@v2.30.0/helper/schema/grpc_provider.go:1249 +0x366
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadDataSource({{0x1153fc0?, 0xc000010660?}}, {0x114c948?, 0xc0003620f0?}, 0xc000d805e0?)
  github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf5to6server/tf5to6server.go:108 +0x1f8
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadDataSource(0x114c980?, {0x114c948?, 0xc000411d10?}, 0xc000d805e0)
  github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf6muxserver/mux_server_ReadDataSource.go:36 +0x19f
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadDataSource(0xc0005120a0, {0x114c948?, 0xc0004110b0?}, 0xc000ae3220)
  github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/tf6server/server.go:697 +0x3df
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadDataSource_Handler({0xf6c380?, 0xc0005120a0}, {0x114c948, 0xc0004110b0}, 0xc000504c00, 0x0)
  github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:539 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004b4000, {0x114c948, 0xc000411020}, {0x1152520, 0xc0006029c0}, 0xc000766240, 0xc000355c80, 0x17f56a8, 0x0)
  google.golang.org/grpc@v1.60.0/server.go:1372 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0004b4000, {0x1152520, 0xc0006029c0}, 0xc000766240)
  google.golang.org/grpc@v1.60.0/server.go:1783 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
  google.golang.org/grpc@v1.60.0/server.go:1016 +0x59
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 43
  google.golang.org/grpc@v1.60.0/server.go:1027 +0x115

Error: The terraform-provider-artifactory_v10.5.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Same problem. Do you have an ETA for a fix?

@tomaskissik Can you provide more background information?

  • Version of terraform are you using?
  • Version of your Artifactory?
  • Can you provider a snippet of the HCL?

So far I have not been able to reproduce this crash in my development environment. Nor does this appear in our CI/CD acceptance tests suite.

Hi @alexhung,

I’ using Terraform v1.5.7
Artifactory EnterpriseX license 7.77.3 rev 77703900

Hi @alexhung

I can also add it worked on artifactory terraform provider 10.4.4. It seems to be terraform version independent, in my test it's failing with terraform 1.7.5. It happens both with local tf state as well as when using terraform enterprise and api / remote state when invoking terraform plan.
Also artifactory versions seem to matter little. In my case we are on 7.77.8 rev.

Since the upgrade to 10.5.0 included and update to terraform-provider-shared I wonder if the problem is within applyTelemetry, for environments that don't have access to the Internet (and using self-hosted artifactory installations).

I noticed the new release 10.5.1. and re-tested there, and also fails.

@kamilsimek-ecb Thanks for the additional details. I'll test that hypothesis out.

@kamilsimek-ecb That was very helpful! I am able to reproduce and track down the coding error. See https://github.com/jfrog/terraform-provider-artifactory/blob/master/pkg/artifactory/provider/sdkv2.go#L104. The error to return should be licenseErr, not err. I'll include this fix as part of #933.

Hello,
it actually fixes the network connection issue
but now the check_license = false is not taken into account anymore

@chaug Thanks for the report! Just pushed 10.6.1 out. It should be on TF registry soon.