diff --git a/changelog.md b/changelog.md index f1c2659862..fde7948ab8 100644 --- a/changelog.md +++ b/changelog.md @@ -10,7 +10,11 @@ and this project adheres to ### Security -Addressed all known, fixable CVEs. +- Addressed all known, fixable CVEs. + +### Fixed + +- Fixed occasional panic due to a concurrent map read/write during runtime setup. ## 0.48.0 diff --git a/pkg/runtime/depot.go b/pkg/runtime/depot.go index 97284343ec..c67b46eed4 100644 --- a/pkg/runtime/depot.go +++ b/pkg/runtime/depot.go @@ -160,6 +160,9 @@ func (d *depot) SetCacheSize(mb int) { // Artifact metadata comes from the depot's cache, and may not exist for installed artifacts that // predate the cache. func (d *depot) Exists(id strfmt.UUID) (bool, *artifactInfo) { + d.mapMutex.Lock() + defer d.mapMutex.Unlock() + if _, ok := d.artifacts[id]; ok { if artifact, exists := d.config.Cache[id]; exists { return true, artifact diff --git a/test/integration/use_int_test.go b/test/integration/use_int_test.go index d9b781eaab..1f133600a4 100644 --- a/test/integration/use_int_test.go +++ b/test/integration/use_int_test.go @@ -126,8 +126,9 @@ func (suite *UseIntegrationTestSuite) TestReset() { cfg, err := config.New() suite.NoError(err) - rcfile, err := subshell.New(cfg).RcFile() - if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) { + if runtime.GOOS != "windows" { + rcfile, err := subshell.New(cfg).RcFile() + fileutils.FileExists(rcfile) suite.NoError(err) suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it") }