Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect must gather versions cache with mutex (#6078)
Currently the code that accesses the must gather versions cache uses a map without any protection agains concurrent writes. As a result in some situations this results in a concurrent writes error: ``` 2024-03-12 03:44:13 fatal error: concurrent map writes github.com/openshift/assisted-service/internal/versions.(*handler).GetMustGatherImages(0xc000222c40, {0xc001dea8a0, 0xb}, {0xc001dea8d4, 0x5}, {0xc0037be000, 0xad2}) /assisted-service/internal/versions/versions.go:95 +0x2e5 ``` This patch uses a mutex to protect access to that map. Note that this is a simple solution, but not ideal, as it means that concurrent calls to the `GetMustGatherImages` method will be serialized. I am not sure if the logic inside that method takes long to execute. If it does this could impact performance. Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
- Loading branch information