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

panic with nil schema block from grpc GetSchema #29212

Open
yherve opened this issue Jul 21, 2021 · 2 comments
Open

panic with nil schema block from grpc GetSchema #29212

yherve opened this issue Jul 21, 2021 · 2 comments
Assignees
Labels
bug confirmed a Terraform Core team member has reproduced this issue core crash v1.0 Issues (primarily bugs) reported against v1.0 releases

Comments

@yherve
Copy link

yherve commented Jul 21, 2021

Terraform Version

Terraform v1.0.2
on linux_amd64
+ provider registry.terraform.io/fp/smc v1.0.0

Terraform Configuration Files

...

Debug Output

tflog.traces.txt

Crash Output

crash.610505221.log

Expected Behavior

not crash

Actual Behavior

crash

Steps to Reproduce

Unfortunately I cannot provide you a way to reproduce.
I am currently developing a provider, but I am not using the official sdk (I interact directly with the grpc protocol)
terraform crashes during the getSchema operation. I have pasted you my own log file where the schema has been dumped.

Additional Context

pytera.log

References

@yherve yherve added bug new new issue not yet triaged labels Jul 21, 2021
@jbardin
Copy link
Member

jbardin commented Jul 21, 2021

Hi @yherve,

It appears that your provider is returning a nil value for a resource block schema, which Terraform is not expecting to handle. The fix in Terraform should be straightforward, checking for a nil value and returning an appropriate error.

I also noticed part of a traceback in the provider logs too, which may indicate that the provider itself encountered an error which is could be contributing to this.

Thanks!

@jbardin jbardin added confirmed a Terraform Core team member has reproduced this issue core crash and removed new new issue not yet triaged labels Jul 21, 2021
@jbardin jbardin changed the title terraform crash panic with nil provider schema block from grpc GetSchema Jul 21, 2021
@jbardin jbardin changed the title panic with nil provider schema block from grpc GetSchema panic with nil schema block from grpc GetSchema Jul 21, 2021
@apparentlymart
Copy link
Member

In addition to what @jbardin said, I'd also note that this is a tricky situation where although we could potentially make a null value just be silently ignored, if we were to do that now then it'd be possible to write a provider that would succeed on newer Terraform versions (where provider developers are most likely to test) but fail on older versions, and thus create difficult-to-diagnose failures.

For that reason, I'd echo @jbardin's point that it'd be better to fix this by explicitly returning an error saying that the provider's response was invalid, so that although it would no longer panic it would still indicate a problem to be solved in the provider-side code in order for the plugin to work successfully for all Terraform versions which support the relevant plugin protocol.

@kmoe kmoe self-assigned this Jun 28, 2022
@apparentlymart apparentlymart added the v1.0 Issues (primarily bugs) reported against v1.0 releases label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed a Terraform Core team member has reproduced this issue core crash v1.0 Issues (primarily bugs) reported against v1.0 releases
Projects
None yet
Development

No branches or pull requests

4 participants