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

Crashing with: Error: rpc error: code = Unavailable desc = transport is closing #16654

Closed
snacks-lord opened this issue Dec 9, 2020 · 12 comments · Fixed by #16692
Closed

Crashing with: Error: rpc error: code = Unavailable desc = transport is closing #16654

snacks-lord opened this issue Dec 9, 2020 · 12 comments · Fixed by #16692
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/workspaces Issues and PRs that pertain to the workspaces service.
Milestone

Comments

@snacks-lord
Copy link

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

Terraform CLI and Terraform AWS Provider Version

Terraform v0.14.2 + provider registry.terraform.io/hashicorp/aws v3.20.0

Affected Resource(s)

  • aws_workspaces_directory
  • aws_workspaces_workspace
  • aws_directory_service_directory

Terraform Configuration Files

  directory_id = aws_directory_service_directory.anotherworkspace.id
  subnet_ids   = ["subnet-xxxxxxxx", "subnet-yyyyyyyyyyyy"]
  #subnet_ids   = ["data.terraform_remote_state.network.public_subnets"]
  
  workspace_creation_properties {
    enable_internet_access = true
    enable_maintenance_mode = true
    #user_enabled_as_local_administrator = false
  }
}

data "aws_workspaces_bundle" "w10_terraform_test" {
  bundle_id = "wsb-5rw9k8l9c" # Value with Windows 10 (English)
}

Debug Output

Error: rpc error: code = Unavailable desc = transport is closing

Panic Output

Expected Behavior

Should at least run plan without error.

Actual Behavior

Getting the error below:
Error: rpc error: code = Unavailable desc = transport is closing

Steps to Reproduce

  1. terraform plan

Important Factoids

It happens all the time.
I can't even get to terraform apply as it happens during terraform plan

References

  • #0000
@ghost ghost added service/directoryservice service/workspaces Issues and PRs that pertain to the workspaces service. labels Dec 9, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 9, 2020
@ewbankkit
Copy link
Contributor

@rmgval Thanks for raising this issue.
Do you have the crash stack trace that you could paste into this issue?

@snacks-lord
Copy link
Author

snacks-lord commented Dec 9, 2020

@rmgval Thanks for raising this issue.
Do you have the crash stack trace that you could paste into this issue?

Hi @ewbankkit I saw this after finally figuring out how to debug:

panic: interface conversion: interface {} is nil, not *workspaces.Workspace
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: goroutine 227 [running]:
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsWorkspacesWorkspaceRead(0xc000b8e200, 0x56ad300, 0xc001cc7700, 0xa7e0c00, 0x64866e0)
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-aws/aws/resource_aws_workspaces_workspace.go:205 +0xadd
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000e2f970, 0x6f42c80, 0xc000f3c5c0, 0xc000b8e200, 0x56ad300, 0xc001cc7700, 0x0, 0x0, 0x0)
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:280 +0x88
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000e2f970, 0x6f42c80, 0xc000f3c5c0, 0xc000e8c0e0, 0x56ad300, 0xc001cc7700, 0xc0011b8350, 0x0, 0x0, 0x0)
2020-12-09T10:57:46.510-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:554 +0x1c2
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000e5c720, 0x6f42c80, 0xc000f3c5c0, 0xc000f3c600, 0xc000f3c5c0, 0x5ece660, 0x615e920)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:571 +0x42f
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc0014ad120, 0x6f42c80, 0xc000f3c5c0, 0xc000e26600, 0xc0014ad120, 0xc000fd9e90, 0xc002032ba0)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/server/server.go:297 +0x101
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x615e920, 0xc0014ad120, 0x6f42d40, 0xc000fd9e90, 0xc000e265a0, 0x0, 0x6f42d40, 0xc000fd9e90, 0xc000f4e600, 0x2d9)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x217
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00058ee00, 0x6f67b80, 0xc001dc6000, 0xc000f36200, 0xc000baf2f0, 0xa7a4ef0, 0x0, 0x0, 0x0)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1194 +0x50a
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: google.golang.org/grpc.(*Server).handleStream(0xc00058ee00, 0x6f67b80, 0xc001dc6000, 0xc000f36200, 0x0)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1517 +0xcfd
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000bd37a0, 0xc00058ee00, 0x6f67b80, 0xc001dc6000, 0xc000f36200)
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:859 +0xa1
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-12-09T10:57:46.511-0500 [DEBUG] plugin.terraform-provider-aws_v3.20.0_x5: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:857 +0x204
2020-12-09T10:57:46.515-0500 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2020/12/09 10:57:46 [TRACE] vertex "aws_workspaces_workspace.anotherworkspace": visit complete
2020/12/09 10:57:46 [TRACE] vertex "aws_workspaces_workspace.anotherworkspace": dynamic subgraph encountered errors
2020/12/09 10:57:46 [TRACE] vertex "aws_workspaces_workspace.anotherworkspace": visit complete
2020/12/09 10:57:46 [TRACE] vertex "aws_workspaces_workspace.anotherworkspace (expand)": dynamic subgraph encountered errors
2020/12/09 10:57:46 [TRACE] vertex "aws_workspaces_workspace.anotherworkspace (expand)": visit complete
2020/12/09 10:57:46 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" errored, so skipping
2020/12/09 10:57:46 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/12/09 10:57:46 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/12/09 10:57:46 [INFO] backend/local: plan operation completed
2020/12/09 10:57:46 [DEBUG] [aws-sdk-go] DEBUG: Request dynamodb/GetItem Details:
---[ REQUEST POST-SIGN ]-----------------------------

@ewbankkit ewbankkit added crash Results from or addresses a Terraform crash or kernel panic. and removed needs-triage Waiting for first response or review from a maintainer. service/directoryservice labels Dec 9, 2020
@ewbankkit
Copy link
Contributor

rawOutput, state, err := waiter.WorkspaceState(conn, d.Id())()
if err != nil {
return fmt.Errorf("error reading workspace (%s): %s", d.Id(), err)
}
if state == workspaces.WorkspaceStateTerminated {
log.Printf("[WARN] workspace (%s) is not found, removing from state", d.Id())
d.SetId("")
return nil
}
workspace := rawOutput.(*workspaces.Workspace)

func WorkspaceState(conn *workspaces.WorkSpaces, workspaceID string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
output, err := conn.DescribeWorkspaces(&workspaces.DescribeWorkspacesInput{
WorkspaceIds: aws.StringSlice([]string{workspaceID}),
})
if err != nil {
return nil, workspaces.WorkspaceStateError, err
}
if len(output.Workspaces) == 0 {
return nil, "", nil
}

@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Dec 9, 2020
@bflad bflad added this to the v3.22.0 milestone Dec 15, 2020
@bflad
Copy link
Contributor

bflad commented Dec 15, 2020

The fix for this has been merged and will release with version 3.22.0 of the Terraform AWS Provider, later this week. Thank you to @Tensho for the fix. 👍

@snacks-lord
Copy link
Author

Was 3.22.0 released? I am still experiencing the same error.

@Tensho
Copy link
Contributor

Tensho commented Dec 17, 2020

@rmgval Will be released at the end of the week. Would appreciate your feedback 🙇

@ghost
Copy link

ghost commented Dec 18, 2020

This has been released in version 3.22.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@snacks-lord
Copy link
Author

Hi,
I just tested and I am still experiencing the same issue..

@Tensho
Copy link
Contributor

Tensho commented Dec 22, 2020

@rmgval Please could you share the crash report, full configuration, debug log and steps to reproduce? Is it possible the workspace under Terraform configuration has been disappeared? Could you also check the actual state (AVAILABLE, TERMINATING, TERMINATED) of the problematic workspace?

@snacks-lord
Copy link
Author

snacks-lord commented Dec 22, 2020

Update:
My apologies. I thought I replied earlier but didn't submit it. I forgot to update my provider version.
I can confirm this works properly now. Thanks again for your help.

1 similar comment
@snacks-lord
Copy link
Author

Update:
My apologies. I thought I replied earlier but didn't submit it. I forgot to update my provider version.
I can confirm this works properly now. Thanks again for your help.

@ghost
Copy link

ghost commented Jan 14, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/workspaces Issues and PRs that pertain to the workspaces service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants