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

helper/schema: Prevent panic with missing InstanceDiff in ReadDataSource #815

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Oct 12, 2021

Closes #813

Previously:

    --- FAIL: TestReadDataSource/optional-no-id (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x12f3f64]

goroutine 20 [running]:
testing.tRunner.func1.2({0x1418300, 0x17d34d0})
        /usr/local/Cellar/go/1.17.1/libexec/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        /usr/local/Cellar/go/1.17.1/libexec/src/testing/testing.go:1212 +0x218
panic({0x1418300, 0x17d34d0})
        /usr/local/Cellar/go/1.17.1/libexec/src/runtime/panic.go:1038 +0x215
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00013ce58, {0x1583cb0, 0xc000128008}, 0xc0001626a0)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider.go:1126 +0x304
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.TestReadDataSource.func9(0xc0002124e0)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider_test.go:1381 +0x6b

Reference: #813

Previously:

```
    --- FAIL: TestReadDataSource/optional-no-id (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x12f3f64]

goroutine 20 [running]:
testing.tRunner.func1.2({0x1418300, 0x17d34d0})
        /usr/local/Cellar/go/1.17.1/libexec/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        /usr/local/Cellar/go/1.17.1/libexec/src/testing/testing.go:1212 +0x218
panic({0x1418300, 0x17d34d0})
        /usr/local/Cellar/go/1.17.1/libexec/src/runtime/panic.go:1038 +0x215
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00013ce58, {0x1583cb0, 0xc000128008}, 0xc0001626a0)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider.go:1126 +0x304
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.TestReadDataSource.func9(0xc0002124e0)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider_test.go:1381 +0x6b
```
@bflad bflad added the bug Something isn't working label Oct 12, 2021
@bflad bflad requested a review from a team October 12, 2021 16:03
@bflad bflad added this to the v2.8.1 milestone Oct 12, 2021
@bflad bflad merged commit 062dd82 into main Oct 14, 2021
@bflad bflad deleted the bflad-b-helper-schema-ReadDataSource-nil-diff-panic branch October 14, 2021 13:46
bflad added a commit that referenced this pull request Oct 14, 2021
@bflad bflad modified the milestones: v2.8.1, v2.9.0 Oct 14, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CRITICAL][v2.8.0] Data resources cause provider segmentation fault on new state
2 participants