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

Plugin crash on delete #39

Closed
rojopolis opened this issue Jan 4, 2021 · 5 comments · Fixed by #40
Closed

Plugin crash on delete #39

rojopolis opened this issue Jan 4, 2021 · 5 comments · Fixed by #40

Comments

@rojopolis
Copy link

I tend to get a lot of plugin crashes while deleting application and project resources. Here's a stacktrace in case it's useful:

module.phoenix.module.eks.module.eks_green.module.argocd[0].module.helm_releases["argo"].argocd_application.this: Destroying... [id=argo-superb-lizard-green]
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: panic: runtime error: invalid memory address or nil pointer dereference
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x106f75d]
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: 
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: goroutine 41 [running]:
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: sync.(*RWMutex).Lock(0x0)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   sync/rwmutex.go:98 +0x2d
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: github.com/oboukili/terraform-provider-argocd/argocd.resourceArgoCDProjectDelete(0xc0007b2af0, 0x2bc3a20, 0xc0007bf500, 0x24, 0x43d8560)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   github.com/oboukili/terraform-provider-argocd/argocd/resource_argocd_project.go:173 +0x181
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0002121b0, 0xc00088cd70, 0xc00086be20, 0x2bc3a20, 0xc0007bf500, 0x100c901, 0x20, 0x2b991e0)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   github.com/hashicorp/terraform-plugin-sdk@v1.14.0/helper/schema/resource.go:283 +0x498
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000574200, 0xc0008dfa10, 0xc00088cd70, 0xc00086be20, 0x43d8560, 0xc00088cd70, 0x0)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   github.com/hashicorp/terraform-plugin-sdk@v1.14.0/helper/schema/provider.go:294 +0x99
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000e088, 0x30f89c0, 0xc000dab050, 0xc0007b23f0, 0xc00000e088, 0xc000dab050, 0xc00074eb78)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   github.com/hashicorp/terraform-plugin-sdk@v1.14.0/internal/helper/plugin/grpc_provider.go:885 +0x8b4
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x2c2e0e0, 0xc00000e088, 0x30f89c0, 0xc000dab050, 0xc00074aa80, 0x0, 0x30f89c0, 0xc000dab050, 0xc000af2480, 0x235)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   github.com/hashicorp/terraform-plugin-sdk@v1.14.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x217
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000703200, 0x3111dc0, 0xc000102d80, 0xc000b9c500, 0xc000335e00, 0x4383fc0, 0x0, 0x0, 0x0)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   google.golang.org/grpc@v1.27.1/server.go:1024 +0x501
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: google.golang.org/grpc.(*Server).handleStream(0xc000703200, 0x3111dc0, 0xc000102d80, 0xc000b9c500, 0x0)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   google.golang.org/grpc@v1.27.1/server.go:1313 +0xd3d
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0003a8250, 0xc000703200, 0x3111dc0, 0xc000102d80, 0xc000b9c500)
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   google.golang.org/grpc@v1.27.1/server.go:722 +0xa1
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7: created by google.golang.org/grpc.(*Server).serveStreams.func1
2021-01-04T11:49:15.467-0800 [DEBUG] plugin.terraform-provider-argocd_v0.4.7:   google.golang.org/grpc@v1.27.1/server.go:720 +0xa1
2021-01-04T11:49:15.469-0800 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/oboukili/argocd/0.4.7/darwin_amd64/terraform-provider-argocd_v0.4.7 pid=54315 error="exit status 2"
2021-01-04T11:49:15.469-0800 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021/01/04 11:49:15 [DEBUG] module.phoenix.module.argocd.argocd_project.pksd: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2021/01/04 11:49:15 [DEBUG] module.phoenix.module.eks.module.eks_green.module.argocd[0].module.helm_releases["argo-rollouts"].argocd_application.this: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing```
@oboukili
Copy link
Collaborator

oboukili commented Jan 5, 2021

Hi, I see that the sync.RWMutex that was set to provide some sort of connection pooling is not working as expected, this is an easy fix that I should be able to take care of later this or next week. Thanks for reporting.

@oboukili
Copy link
Collaborator

Hello, some updates since I have begun working on this, this has nothing to do with the connection pooling feature (fortunately) and is actually an edge case with projects deletion:

the sync.RWMutex object is present to handle concurrent modification of the same project, while allowing for simultaneous reads of that project (for example adding a project token, or modifying a project syncWindow are competing operations that will impact each other) to offer acceptable performance on large TF plans that include a lot of ArgoCD resources.

It seems the TF test framework differs a bit from reality, since this has never been an issue during the automated CI: the Go objects instanciated within the testing automated plan part are kept in memory during the automated destruction part.

I will publish an hotfix soon that should not break anything, and will definitely solve the issue highlighted by your logs above.

@oboukili
Copy link
Collaborator

@rojopolis , release 0.4.8 contains the aforementioned fix (#40), feedback would be much appreciated!

@rojopolis
Copy link
Author

Hi @oboukili It seems to be fixed! Thanks so much for taking care of it.

@oboukili
Copy link
Collaborator

Glad to hear it :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants