Skip to content

fix: add mutex to LocalRepositoryCache to prevent concurrent map panic#6109

Open
AruneshDwivedi wants to merge 2 commits into
nektos:masterfrom
AruneshDwivedi:fix/local-repository-cache-race
Open

fix: add mutex to LocalRepositoryCache to prevent concurrent map panic#6109
AruneshDwivedi wants to merge 2 commits into
nektos:masterfrom
AruneshDwivedi:fix/local-repository-cache-race

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

What this fixes

LocalRepositoryCache.CacheDirCache is a plain map accessed concurrently by Fetch (write) and GetTarArchive (read) when multiple matrix jobs resolve --local-repository actions in parallel. This causes intermittent 'concurrent map read and map write' panics.

Root cause

No synchronization on the CacheDirCache map. Same class of bug as #6028 (fixed in #6029 for GoGitActionCache).

What I changed

  • Added sync.RWMutex to LocalRepositoryCache struct
  • Write lock in Fetch when storing to CacheDirCache
  • Read lock in GetTarArchive when reading from CacheDirCache

Fixes #6057

…l/bin

The install script was defaulting to ./bin (relative to current
working directory) instead of a proper user bin directory. This
caused act to be installed in whatever directory the user happened
to be in when running the install script, making it unfindable.

Fixes nektos#2519
LocalRepositoryCache.CacheDirCache is a plain map accessed concurrently
by Fetch (write) and GetTarArchive (read) when multiple matrix jobs
resolve --local-repository actions in parallel. This causes intermittent
'concurrent map read and map write' panics.

Add a sync.RWMutex to protect CacheDirCache access:
- Write lock in Fetch when storing to CacheDirCache
- Read lock in GetTarArchive when reading from CacheDirCache

This is the same class of bug as nektos#6028 (fixed in nektos#6029 for GoGitActionCache).

Fixes nektos#6057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrent map write when running a build that produces parallel builds

1 participant