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

fix: Race condition on execution when context closes #276

Closed
wants to merge 2 commits into from

Conversation

kylecarbs
Copy link
Contributor

Accessing ProcessState on non-linux operating systems immediately
after context cancels can conflict with the Wait() stdlib func:
https://github.com/golang/go/blob/36b81acfa19d9fedf6a0cd60c394fd7a7703834e/src/os/exec/exec.go#L511

@kylecarbs
Copy link
Contributor Author

==================
WARNING: DATA RACE
Write at 0x00c000bf5548 by goroutine 33:
  os/exec.(*Cmd).Wait()
      /opt/hostedtoolcache/go/1.17.6/x64/src/os/exec/exec.go:511 +0x15d
  os/exec.(*Cmd).Run()
      /opt/hostedtoolcache/go/1.17.6/x64/src/os/exec/exec.go:341 +0x64
  github.com/hashicorp/terraform-exec/tfexec.(*Terraform).runTerraformCmd()
      /home/runner/go/pkg/mod/github.com/kylecarbs/[email protected]/tfexec/cmd_linux.go:45 +0x4a7
  github.com/hashicorp/terraform-exec/tfexec.(*Terraform).version()
      /home/runner/go/pkg/mod/github.com/kylecarbs/[email protected]/tfexec/version.go:55 +0x193
  github.com/hashicorp/terraform-exec/tfexec.(*Terraform).Version()
      /home/runner/go/pkg/mod/github.com/kylecarbs/[email protected]/tfexec/version.go:39 +0x12d
  github.com/coder/coder/provisioner/terraform.(*terraform).Provision()
      /home/runner/work/coder/coder/provisioner/terraform/provision.go:33 +0x2e4
  github.com/coder/coder/provisionersdk/proto.DRPCProvisionerDescription.Method.func2()
      /home/runner/work/coder/coder/provisionersdk/proto/provisioner_drpc.pb.go:161 +0x108
  storj.io/drpc/drpcmux.(*Mux).HandleRPC()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcmux/handle_rpc.go:33 +0x305
  storj.io/drpc/drpcserver.(*Server).handleRPC()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcserver/server.go:122 +0x71
  storj.io/drpc/drpcserver.(*Server).ServeOne()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcserver/server.go:66 +0x2da
  storj.io/drpc/drpcserver.(*Server).Serve.func2()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcserver/server.go:112 +0x76
  storj.io/drpc/drpcctx.(*Tracker).track()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcctx/transport.go:52 +0x3d
  storj.io/drpc/drpcctx.(*Tracker).Run·dwrap·1()
      /home/runner/go/pkg/mod/storj.io/[email protected]/drpcctx/transport.go:47 +0x47

Previous read at 0x00c000bf5548 by goroutine 119:
  github.com/hashicorp/terraform-exec/tfexec.(*Terraform).runTerraformCmd.func1()
      /home/runner/go/pkg/mod/github.com/kylecarbs/[email protected]/tfexec/cmd_linux.go:26 +0x185

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

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