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

Disable the client cache for Workspace lookups #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

toastwaffle
Copy link
Contributor

Description of your changes

Fixes #243 (sort of)

This disables the cache used when getting Workspace resources at the start of each reconciliation to avoid a potential concurrent map iteration/write, caused by the client-go workqueue not being fully deduplicated. That's an upstream bug, for which this PR is a mitigation to prevent the provider crashing.

I'm not totally convinced that this is the right thing to do. If we are actually seeing concurrent reconciliations of the same workspace, maybe it is better to crash; the problem is that crashing has the potential to leave workspaces in an inconsistent state (i.e. half-applied, with the state lock left around), and causes all workspaces to be reconciled at once when the provider starts back up.

If we do see concurrent reconciles, we should still be protected by the terraform state lock, although we might see strange errors/status on the resource.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Unit tests passed; I intend to rely on the Github Action integration test to assert that the provider still works as intended, but the actual bug happens very rarely (With 100+ Workspaces we saw provider-terraform go 10 days without crashing) so it's hard to prove that this fixes the issue.

@turkenf
Copy link
Contributor

turkenf commented Sep 24, 2024

/test-examples="examples/workspace-inline-aws.yaml"

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.

concurrent map iteration and map write panic
2 participants