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] Long flow names cause a panic during plan/apply #230

Closed
dbryar opened this issue Nov 22, 2023 · 7 comments · Fixed by #232
Closed

[BUG] Long flow names cause a panic during plan/apply #230

dbryar opened this issue Nov 22, 2023 · 7 comments · Fixed by #232
Labels
status/triaged The issue/PR has completed initial triage and needs assignment

Comments

@dbryar
Copy link

dbryar commented Nov 22, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

DaVinci Terraform provider Version

0.1.13

Terraform Version

1.4.2

Affected Resource(s)

  • davinci_flow

Terraform Configuration Files

N/A

Panic Output

╷
│ Error: Plugin did not respond
│ 
│   with davinci_flow.portal_login,
│   on dev.tf line 19973, in resource "davinci_flow" "portal_login":
│ 19973: resource "davinci_flow" "portal_login"{
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).PlanResourceChange call. The plugin logs may contain
│ more details.
╵

Stack trace from the terraform-provider-davinci_v0.1.13 plugin:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 883 [running]:
github.com/pingidentity/terraform-provider-davinci/internal/service/davinci.expandSubFlowProps(0xc0001349c0?)
	github.com/pingidentity/terraform-provider-davinci/internal/service/davinci/resource_flow.go:774 +0x439
github.com/pingidentity/terraform-provider-davinci/internal/service/davinci.mapSubFlows(0xcc5720?, {0xc000d80000, 0x24b95})
	github.com/pingidentity/terraform-provider-davinci/internal/service/davinci/resource_flow.go:736 +0x272
github.com/pingidentity/terraform-provider-davinci/internal/service/davinci.computeFlowDrift({0x4e601f?, 0xcfdd88?}, {0xc000c5c000, 0x19922}, {0xc000d80000, 0x24b95}, 0xc00005fa00?)
	github.com/pingidentity/terraform-provider-davinci/internal/service/davinci/resource_flow.go:526 +0xcf
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x6?, {0xe27320, 0xc000448d80}, {0xcfdd88, 0x9}, 0xc00043c8c0, 0xc00005f980, {0xe2a0f0?, 0xc00005fa00}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1143 +0x39b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc00042bbc0, {0xe27320, 0xc000448d80}, 0xc000144c30, 0xc000137110, 0x0, {0xce5860, 0xc00028b680}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:[678](-/jobs/5591562852#L678) +0x353
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xe27a58?, {0xe27320?, 0xc000448d80?}, 0xc000144c30, 0xc0c640?, {0xce5860?, 0xc00028b[680](-/jobs/5591562852#L680)?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:962 +0xe5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc0003fbaa0, {0xe27320?, 0xc000448b10?}, 0xc0006a3220)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:780 +0xa09
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0004f5d60, {0xe27320?, 0xc00042b080?}, 0xc00041e1c0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:824 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xcc6fe0?, 0xc0004f5d60}, {0xe27320, 0xc00042b080}, 0xc00041e150, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:449 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004c05a0, {0xe2afb8, 0xc0005829c0}, 0xc000420240, 0xc0004482d0, 0x1341120, 0x0)
	google.golang.org/[email protected]/server.go:1360 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc0004c05a0, {0xe2afb8, 0xc0005829c0}, 0xc000420240, 0x0)
	google.golang.org/[email protected]/server.go:1737 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:982 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:980 +0x18c
Error: The terraform-provider-davinci_v0.1.13 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.

Expected Behavior

Should apply terraform plan

Actual Behavior

It crashed

Steps to Reproduce

  1. create a flow json and name the flow with something > limit chars
  2. terraform apply

Important Factoids

The flow refused to import in to DaVinci console until I reduced the length of the flow name. Not sure if this is the only reason for the crash, however it seems that a flow/subflow with a long/descriptive name causes a panic

@dbryar
Copy link
Author

dbryar commented Nov 23, 2023

fixing name doesn't fix this. There is something else afoot but I'm not posting the JSON flow on Github

@dbryar
Copy link
Author

dbryar commented Nov 23, 2023

It looks like a missing version was the culprit.

              "subFlowVersionId": {
                "value": -1
              }

I suspect it needs a value check in the routine somewhere?

@samir-gandhi samir-gandhi linked a pull request Dec 4, 2023 that will close this issue
@samir-gandhi
Copy link
Contributor

@dbryar thanks for opening this, I included handling for the issue in the latest (v0.2.0) release. Note, to use the latest release there is a small config update required.

@dbryar
Copy link
Author

dbryar commented Apr 12, 2024

@samir-gandhi I believe this bug has been reintroduced in v0.3.0

The previous version shows

│ Error: Flow Validation Error: subFlowVersionId not found in subflow properties
│ 
│   with davinci_flow.error_handler,
│   on cdk.tf.json line 881, in resource.davinci_flow.error_handler:
│  881:       },

And in v0.3.0 we had a fairly lengthy investigation trying to work out this error, until rolling back

╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ValidateResourceConfig call. The plugin logs may
│ contain more details.
╵
Stack trace from the terraform-provider-davinci_v0.3.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xc378ca]
goroutine 278 [running]:
github.com/pingidentity/terraform-provider-davinci/internal/service/davinci.validateConnectionSubflowLinkMappings({0xf84548, 0xc000b7ce40}, {{0x2, {0xc00133aa80, 0x633d}}, {0x0, 0x0, 0x1, 0x0, 0x1, ...}}, ...)
	github.com/pingidentity/terraform-provider-davinci/internal/service/davinci/resource_flow.go:1233 +0x10ea
github.com/pingidentity/terraform-provider-davinci/internal/service/davinci.(*FlowResource).ValidateConfig(0xc000b7ce40?, {0xf84548, 0xc000b7ce40}, {{{{0xf891c0, 0xc0013486c0}, {0xcfb400, 0xc0013338c0}}, {0xf8a918, 0xc0002add60}}}, 0xc00[130](https://gitlab.com/b707/platform-and-payments/pinocchio/-/jobs/6605732925#L130)6b28)
	github.com/pingidentity/terraform-provider-davinci/internal/service/davinci/resource_flow.go:505 +0x1dd
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ValidateResourceConfig(0xc000467d40, {0xf84548, 0xc000b7ce40}, 0xc0013061c8, 0xc001357650)
	github.com/hashicorp/[email protected]/internal/fwserver/server_validateresourceconfig.go:93 +0x44b
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ValidateResourceConfig(0xc000467d40, {0xf84548?, 0xc000b7cd20?}, 0xc001306150)
	github.com/hashicorp/[email protected]/internal/proto6server/server_validateresourceconfig.go:47 +0x47d
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ValidateResourceConfig(0xf84580?, {0xf84548?, 0xc000b7ca20?}, 0xc001306150)
	github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ValidateResourceConfig.go:36 +0x192
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ValidateResourceConfig(0xc00065f4a0, {0xf84548?, 0xc000b7c2a0?}, 0xc001302080)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:716 +0x2eb
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ValidateResourceConfig_Handler({0xde8040?, 0xc00065f4a0}, {0xf84548, 0xc000b7c2a0}, 0xc00[131](https://gitlab.com/b707/platform-and-payments/pinocchio/-/jobs/6605732925#L131)e080, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:410 +0x16c
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000637e00, {0xf84548, 0xc000b7c1e0}, {0xf89ad0, 0xc0005031e0}, 0xc001308000, 0xc0004138c0, 0x156b368, 0x0)
	google.golang.org/[email protected]/server.go:1385 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc000637e00, {0xf89ad0, 0xc0005031e0}, 0xc001308000)
	google.golang.org/[email protected]/server.go:1796 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 40
	google.golang.org/[email protected]/server.go:1040 +0x[135](https://gitlab.com/b707/platform-and-payments/pinocchio/-/jobs/6605732925#L135)
Error: The terraform-provider-davinci_v0.3.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.

@samir-gandhi samir-gandhi added the status/needs-triage The issue/PR needs initial triage label Apr 12, 2024
@samir-gandhi
Copy link
Contributor

samir-gandhi commented Apr 12, 2024

@dbryar thank you for bringing this up, I've added the triage label as we look into it

@dbryar
Copy link
Author

dbryar commented Apr 12, 2024

I've done a lot more research/debugging; opened a new ticket

@patrickcping patrickcping added status/triaged The issue/PR has completed initial triage and needs assignment and removed status/needs-triage The issue/PR needs initial triage labels Apr 12, 2024
@patrickcping
Copy link
Contributor

Resuming the thread on #289 , we'll leave this ticket closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triaged The issue/PR has completed initial triage and needs assignment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants