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

[BUG]: Error: The terraform-provider-github_v5.32.0 plugin crashed! #1821

Closed
1 task done
NicholasFiorentini opened this issue Aug 3, 2023 · 8 comments
Closed
1 task done
Labels
Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Comments

@NicholasFiorentini
Copy link

Describe the need

I use a Terraform Cloud pipeline to configure some GitHub repositories for my organization. This pipeline was running fine (last successful run was 3 weeks ago). Today I added a new configuration, reusing the same resources, but the Terrafom Cloud plan failed with a crash error (see log):

Stack trace from the terraform-provider-github_v5.32.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x1017a30]

Environment:

Terraform 1.4.6
Running on Terraform Cloud

provider.tf:

terraform {
  backend "remote" {
    organization = "xxx-bio"
    workspaces {
      name = "github-configs"
    }
  }
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
  required_version = ">= 1.4.0"
}

provider "github" {
  owner = "xxx"
}

SDK Version

terraform-provider-github_v5.32.0

API Version

No response

Relevant log output

Terraform v1.4.6
on linux_amd64
Initializing plugins and modules...
data.terraform_remote_state.xxx_workspaces_test: Reading...
data.terraform_remote_state.xxx_workspaces_prod: Reading...
module.infrastructure_repo_github_env["xxx-containers-test"].github_repository_environment.repo_environment: Refreshing state... [id=xxx-containers:test]
module.infrastructure_repo_github_env["xxx-containers-prod"].github_repository_environment.repo_environment: Refreshing state... [id=xxx-containers:prod]
github_actions_secret.xxx_secret["xxx"]: Refreshing state... [id=xxx:xxx]
github_actions_secret.xxx_secret["xxx.ds.preprocess"]: Refreshing state... [id=xxx.ds.preprocess:xxx]
data.terraform_remote_state.xxx_workspaces_test: Read complete after 0s
data.terraform_remote_state.xxx_workspaces_prod: Read complete after 0s

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Plugin did not respond
│ 
│   with github_actions_secret.xxx_secret["xxx.ds.preprocess"],
│   on submodules_cicd.tf line 5, in resource "github_actions_secret" "xxx_secret":
│    5: resource "github_actions_secret" "xxx_secret" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with github_actions_secret.xxx_secret["xxx"],
│   on submodules_cicd.tf line 5, in resource "github_actions_secret" "xxx_secret":
│    5: resource "github_actions_secret" "xxx_secret" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.
╵

...

╷
│ Error: Plugin did not respond
│ 
│   with module.infrastructure_repo_github_env["xxx-containers-test"].github_repository_environment.repo_environment,
│   on github_repo_environment/main.tf line 1, in resource "github_repository_environment" "repo_environment":
│    1: resource "github_repository_environment" "repo_environment" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.
╵

Stack trace from the terraform-provider-github_v5.32.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x1017a30]

goroutine 41 [running]:
github.com/integrations/terraform-provider-github/v5/github.resourceGithubRepositoryEnvironmentRead(0xc00063c380, {0x10c8000?, 0xc000730440?})
	github.com/integrations/terraform-provider-github/v5/github/resource_github_repository_environment.go:137 +0x4b0
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0002a63c0, 0xc00063a050, {0x10c8000, 0xc000730440})
	github.com/hashicorp/[email protected]/helper/schema/resource.go:470 +0x1aa
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadResource(0xc000293470, {0xc000aabe00?, 0x4b87a6?}, 0xc000aabe00)
	github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:535 +0x34b
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler({0x12eeda0?, 0xc000293470}, {0x16abbf8, 0xc000ad5110}, 0xc000ad2690, 0x0)
	github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3269 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00052c1e0, {0x16afe38, 0xc000612340}, 0xc00035a120, 0xc0005888d0, 0x1f57250, 0x0)
	google.golang.org/[email protected]/server.go:1337 +0xde3
google.golang.org/grpc.(*Server).handleStream(0xc00052c1e0, {0x16afe38, 0xc000612340}, 0xc00035a120, 0x0)
	google.golang.org/[email protected]/server.go:1714 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:959 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:957 +0x18c

Error: The terraform-provider-github_v5.32.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.

Operation failed: failed running terraform plan (exit 1)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@NicholasFiorentini NicholasFiorentini added Status: Triage This is being looked at and prioritized Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR labels Aug 3, 2023
@github-actions
Copy link

github-actions bot commented Aug 3, 2023

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@NicholasFiorentini
Copy link
Author

I tried to force previous versions of the plugin (5.31.0 and 5.27.0) with no success.

@NicholasFiorentini
Copy link
Author

Possible duplicate of #1818?

@NicholasFiorentini
Copy link
Author

This was working 23 days ago.

@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Aug 4, 2023
@kfcampbell kfcampbell removed the Status: Triage This is being looked at and prioritized label Aug 10, 2023
@phyzical
Copy link

phyzical commented Aug 11, 2023

we just started running into this too a few days ago but we were pinned to version 5.25.1 and ci just began failing, and ours is around resourceGithubRepositoryRead instead of resourceGithubRepositoryEnvironmentRead

one thing we did notice is for us its started around the time that terraform 1.5.5 was released, but rolling back to 1.5.4 doesn't seem to make a difference

We also did try the latest version 5.32.0 but got the same issue


Stack trace from the terraform-provider-github_v5.25.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104ac63cc]

goroutine 304 [running]:
github.com/integrations/terraform-provider-github/v5/github.resourceGithubRepositoryRead(0x140008667e0, {0x104ed5620?, 0x1400063a400?})
        github.com/integrations/terraform-provider-github/v5/github/resource_github_repository.go:664 +0xe6c
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).RefreshWithoutUpgrade(0x14000020640, 0x1400015cb40, {0x104ed5620, 0x1400063a400})
        github.com/hashicorp/[email protected]/helper/schema/resource.go:470 +0x1ac
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadResource(0x14000306490, {0x14000190c00?, 0x0?}, 0x14000190c00)
        github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:535 +0x338
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler({0x1050d0be0?, 0x14000306490}, {0x10512d070, 0x14000b16f60}, 0x14000866380, 0x0)
        github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3269 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x140002d2000, {0x105130ee8, 0x140006424e0}, 0x14000b24fc0, 0x140003ed320, 0x10592d6b0, 0x0)
        google.golang.org/[email protected]/server.go:1340 +0xb90
google.golang.org/grpc.(*Server).handleStream(0x140002d2000, {0x105130ee8, 0x140006424e0}, 0x14000b24fc0, 0x0)
        google.golang.org/[email protected]/server.go:1713 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:965 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:963 +0x298

Error: The terraform-provider-github_v5.25.1 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.

make: *** [plan] Error 1

EDIT: turns out our problem is unrelated and for some reason we had a repository with a repository template that was made private thus no owner causing the segfault. ill create a separate issue to discuss how to fix this.

@ivan-kiselev
Copy link

ivan-kiselev commented Aug 13, 2023

Same, can't downgrade the version since we want to use github_repository_environment_deployment_policy and it only is present in the latest two versions, both of them are are crashing int he described way

Edit: Actually, mine crashes on github_repository_environment:

│ Error: Plugin did not respond
│ 
│   with github_repository_environment.production["EDITED"],
│   on main_branch.tf line 77, in resource "github_repository_environment" "production":
│   77: resource "github_repository_environment" "production" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵

Stack trace from the terraform-provider-github_v5.33.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x1018670]

goroutine 54 [running]:
github.com/integrations/terraform-provider-github/v5/github.resourceGithubRepositoryEnvironmentRead(0xc00019b2d0, {0x10c9160?, 0xc0006588c0?})
	github.com/integrations/terraform-provider-github/v5/github/resource_github_repository_environment.go:137 +0x4b0
github.com/integrations/terraform-provider-github/v5/github.resourceGithubRepositoryEnvironmentCreate(0x1166ac0?, {0x10c9160?, 0xc0006588c0})
	github.com/integrations/terraform-provider-github/v5/github/resource_github_repository_environment.go:107 +0x2e5
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0000b81e0, 0xc0008ef680, 0xc0006430c0, {0x10c9160, 0xc0006588c0})
	github.com/hashicorp/[email protected]/helper/schema/resource.go:320 +0x438
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc0000a6300, 0xc0008218d0, 0x134cf28?, 0xf?)
	github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0x70
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000ea08, {0xc00019abd0?, 0x4b8826?}, 0xc00019abd0)
	github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:895 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x12f0b00?, 0xc00000ea08}, {0x16ad318, 0xc0008656b0}, 0xc00019aa80, 0x0)
	github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001d6000, {0x16b1558, 0xc0004a8680}, 0xc0009987e0, 0xc00041a7e0, 0x1f59280, 0x0)
	google.golang.org/[email protected]/server.go:1337 +0xde3
google.golang.org/grpc.(*Server).handleStream(0xc0001d6000, {0x16b1558, 0xc0004a8680}, 0xc0009987e0, 0x0)
	google.golang.org/[email protected]/server.go:1714 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:959 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:957 +0x18c

@NicholasFiorentini
Copy link
Author

Update: it seems an expired GitHub PAT causes this. We generated a new token, and the provider works. Maybe the provider should not crash when the token is expired.

@muawiakh
Copy link

Fixed in 5.40.0: #1932

Provider returns:

403 Resource not accessible by integration []

@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR
Projects
None yet
Development

No branches or pull requests

5 participants