-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
terraform: share graph walker's variables lock w/ interpolater #5772
Conversation
The ContextGraphWalker struct includes a lock that's passed down to BuiltinEvalContext and guards access to interpolation variables as they're written using SetVariables. The likely problem being expressed in #5733 is that the same map reference is also passed down to the Interpolater.Variables field, which is used for variable lookup. Here, we plumb the same lock we're using to guard access for writes down and acquire it before doing variable reads as well. It's not as fine grained as perhaps it could be, but all the context tests pass and I believe this should address #5733.
@@ -273,6 +274,8 @@ func (i *Interpolater) valueUserVar( | |||
n string, | |||
v *config.UserVariable, | |||
result map[string]ast.Variable) error { | |||
i.VariablesLock.Lock() | |||
defer i.VariablesLock.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need to defer here, just unlock right below the next line.
One comment, then go for merge. |
db06574
to
024dcc9
Compare
There's a |
Oh I missed it. Sounds good. |
terraform: share graph walker's variables lock w/ interpolater
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
The ContextGraphWalker struct includes a lock that's passed down to
BuiltinEvalContext and guards access to interpolation variables as
they're written using SetVariables.
The likely problem being expressed in #5733 is that the same map
reference is also passed down to the Interpolater.Variables field, which
is used for variable lookup.
Here, we plumb the same lock we're using to guard access for writes down
and acquire it before doing variable reads as well. It's not as fine
grained as perhaps it could be, but all the context tests pass and I
believe this should address #5733.