Make installer's Ensure
/Install
& Remove
methods thread-safe
#35
Labels
enhancement
New feature or request
Milestone
While reading the relevant code I realized that we make (somewhat unconscious) assumption that the state (removable files) only survives until the next Ensure or Install call, so the user can't really call both or one of those repeatedly, unless they also always call Remove before.
There is a number of problems related to thread-safety currently:
hc-install/installer.go
Line 17 in e677aa4
We track the state in a slice which isn't guarded by any synchronization mechanism, so if someone was to call
Ensure
andRemove
at the same time this could result in a data race condition.Additionally the state is shared between both
Ensure
andInstall
methods and theRemove
method would just remove any removable files that are currently present in the slice.hc-install/installer.go
Lines 126 to 133 in e677aa4
The text was updated successfully, but these errors were encountered: