orange-cloudfoundry / terraform-provider-cloudfoundry

A terraform provider to manage a Cloud Foundry instance.
Apache License 2.0
31 stars 8 forks source link

Provider crash: concurrent map read and map write during translation #1

Closed ArthurHlt closed 7 years ago

ArthurHlt commented 7 years ago

Terraform run each resource in parallel and an error occurred sometimes during getting the list of organization:

/Users/arthurhalet/.gobrew/versions/1.7/src/runtime/panic.go:566 +0x95 fp=0xc4207ec340 sp=0xc4207ec320
runtime.mapaccess1_faststr(0x6c5580, 0xc4203a1c50, 0x799668, 0x15, 0xc4203a2ff8)
/Users/arthurhalet/.gobrew/versions/1.7/src/runtime/hashmap_fast.go:201 +0x4f3 fp=0xc4207ec3a0 sp=0xc4207ec340
code.cloudfoundry.org/cli/vendor/github.com/nicksnyder/go-i18n/i18n/bundle.(*Bundle).translate(0xc42000c700, 0xc4204bc440, 0x799668, 0x15, 0x0, 0x0, 0x0, 0xd4, 0xc4200c30e0)
/Users/arthurhalet/go/src/code.cloudfoundry.org/cli/vendor/github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:238 +0xb1 fp=0xc4207ec468 sp=0xc4207ec3a0
code.cloudfoundry.org/cli/vendor/github.com/nicksnyder/go-i18n/i18n/bundle.(*Bundle).TfuncAndLanguage.func1(0x799668, 0x15, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/arthurhalet/go/src/code.cloudfoundry.org/cli/vendor/github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:195 +0x65 fp=0xc4207ec4c0 sp=0xc4207ec468

[...]

code.cloudfoundry.org/cli/cf/api/organizations.CloudControllerOrganizationRepository.GetManyOrgsByGUID(0x21480e0, 0xc4201d6d80, 0x0, 0x0, 0x7f7628, 0x1, 0x12a05f200, 0x0, 0x0, 0x0, ...)
/Users/arthurhalet/go/src/code.cloudfoundry.org/cli/cf/api/organizations/organizations.go:60 +0x29a fp=0xc4207ed0f0 sp=0xc4207ecda8
github.com/orange-cloudfoundry/terraform-provider-cloudfoundry/resources.CfOrganizationResource.getOrgFromCf(0x0, 0x0, 0xb15740, 0xc420294000, 0xc4206845a0, 0x24, 0x0, 0x0, 0x0, 0x0, ...)
/Users/arthurhalet/go/src/github.com/orange-cloudfoundry/terraform-provider-cloudfoundry/resources/organizations.go:93 +0x129 fp=0xc4207ed4c8 sp=0xc4207ed0f0
github.com/orange-cloudfoundry/terraform-provider-cloudfoundry/resources.CfOrganizationResource.Read(0x0, 0x0, 0xc4207a1740, 0x76f420, 0xc420294000, 0x0, 0xb0b4c0)

The error come from https://github.com/nicksnyder/go-i18n which is writing and reading in same time on a map (still cause terraform run resource in parallel)

This the cloud foundry CLI which use go-i18n to do translation. Like we use some part of the cli to use it as a client for Cloud Foundry we are really tied to this translation functionality (cause the cli is tied to it).

Fortunately pull request and issue are already addressed to this repo:

ArthurHlt commented 7 years ago

Fix https://github.com/nicksnyder/go-i18n/pull/59 has been merged