Skip to content

fix(blockStorage): Prevent invalid field caused panic #463

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

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

wonchulee
Copy link
Collaborator

  • Add to guard to prevent an invalid field used in the block storage.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0xc8 pc=0x102e8db9c]

goroutine 34 [running]:
github.com/terraform-providers/terraform-provider-ncloud/internal/service/server.createVpcBlockStorage(0x140005e6a00, 0x140006cc3c0)
	/Users/wonchul/work/ncloud/terraform/terraform-provider-ncloud/internal/service/server/block_storage.go:401 +0x8dc
github.com/terraform-providers/terraform-provider-ncloud/internal/service/server.createBlockStorage(0x1400007a4f0?, 0x102fd3325?)
	/Users/wonchul/work/ncloud/terraform/terraform-provider-ncloud/internal/service/server/block_storage.go:313 +0x24
github.com/terraform-providers/terraform-provider-ncloud/internal/service/server.resourceNcloudBlockStorageCreate(0x140005e6a00, {0x1032b58a0, 0x140006cc3c0})
	/Users/wonchul/work/ncloud/terraform/terraform-provider-ncloud/internal/service/server/block_storage.go:175 +0x70
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x10359a318?, {0x10359a318?, 0x14000155080?}, 0xd?, {0x1032b58a0?, 0x140006cc3c0?})
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:794 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140003dc1c0, {0x10359a318, 0x14000155080}, 0x140003528f0, 0x140005e6880, {0x1032b58a0, 0x140006cc3c0})
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:937 +0x874
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400000da10, {0x10359a318?, 0x14000154f00?}, 0x140006363c0)
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xaa4
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x1035a6628?, 0x1400000da10?}}, {0x10359a318, 0x14000154f00}, 0x0?)
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:38 +0x58
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x1400042a8c0, {0x10359a318?, 0x14000154c30?}, 0x14000636370)
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x14000412140, {0x10359a318?, 0x14000154240?}, 0x14000264070)
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x10353d0c0, 0x14000412140}, {0x10359a318, 0x14000154240}, 0x140005e6000, 0x0)
	/Users/wonchul/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001a4e00, {0x10359a318, 0x140001541b0}, {0x1035a2200, 0x14000430180}, 0x140001e8000, 0x140001bfec0, 0x103ef94d8, 0x0)
	/Users/wonchul/go/pkg/mod/google.golang.org/[email protected]/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x140001a4e00, {0x1035a2200, 0x14000430180}, 0x140001e8000)
	/Users/wonchul/go/pkg/mod/google.golang.org/[email protected]/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	/Users/wonchul/go/pkg/mod/google.golang.org/[email protected]/server.go:1019 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 27
	/Users/wonchul/go/pkg/mod/google.golang.org/[email protected]/server.go:1030 +0x13c

Error: The terraform-provider-ncloud plugin crashed!

@wonchulee wonchulee requested a review from youngmn as a code owner October 18, 2024 12:22
Copy link
Collaborator

@youngmn youngmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@youngmn youngmn merged commit 7f90603 into NaverCloudPlatform:main Oct 18, 2024
2 checks passed
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 this pull request may close these issues.

2 participants