-
Notifications
You must be signed in to change notification settings - Fork 216
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
Fix sporadic panic when processing service dependencies #376
Fix sporadic panic when processing service dependencies #376
Conversation
Oops, the error still happens:
|
With additional traces:
|
I've added checks to avoid the panic. In real situation, the user will be able to retry in the import. Turns out the
When this happens, the acceptance test fails with the following error:
|
I've added checks to avoid crashing the provider and leave dangling resources when disassociation fails. Tests sometimes still fail, but it feels way less critical like that:
|
Rebased on master, @stmcallister PTAL. |
…ference` error: ``` make testacc TEST=./pagerduty TESTARGS='-run=TestAccPagerDutyServiceDependency_import -count=1' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./pagerduty -v -run=TestAccPagerDutyServiceDependency_import -count=1 -timeout 120m === RUN TestAccPagerDutyServiceDependency_import panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf20d08] goroutine 365 [running]: github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.resourcePagerDutyServiceDependencyRead(0xc0002de690, {0x11215a0, 0xc000372280}) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/pagerduty/resource_pagerduty_service_dependency.go:195 +0x108 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00014df80, 0xc00090b360, {0x11215a0, 0xc000372280}) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:455 +0x1aa github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadResource(0xc000010878, {0xc00090b270, 0x503ae6}, 0xc00090b270) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:525 +0x34b github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler({0x1166600, 0xc000010878}, {0x145ad90, 0xc000aaa690}, 0xc00039c9c0, 0x0) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3153 +0x170 google.golang.org/grpc.(*Server).processUnaryRPC(0xc000b361c0, {0x14701c0, 0xc000298600}, 0xc0007ac300, 0xc0008e8150, 0x1c0d7b0, 0x0) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/google.golang.org/grpc/server.go:1210 +0xc8f google.golang.org/grpc.(*Server).handleStream(0xc000b361c0, {0x14701c0, 0xc000298600}, 0xc0007ac300, 0x0) /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/google.golang.org/grpc/server.go:1533 +0xa2a google.golang.org/grpc.(*Server).serveStreams.func1.2() /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/google.golang.org/grpc/server.go:871 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 /home/patrick/go/src/github.com/PagerDuty/terraform-provider-pagerduty/vendor/google.golang.org/grpc/server.go:869 +0x294 FAIL github.com/terraform-providers/terraform-provider-pagerduty/pagerduty 11.996s FAIL make: *** [GNUmakefile:17: testacc] Error 1 ```
…e_dependencies/* APIs are eventually consistent
… properly set, and address linter warnings
… as everything is already available in /service_dependencies/associate response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Totally appreciate the resources and tests being more stable. 🎉
This PR fixes
panic: runtime error: invalid memory address or nil pointer dereference
errors that happen from time to time when running acceptance tests:It also enforces that one and only one dependency block must be defined for a
pagerduty_service_dependency
resource given the current implementation: