synchronize access to netrcCredentialHelper.skip #3896
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We run into concurrent map read/write error.
Here is a snippet of the stack trace:
goroutine 664 [running]: runtime.throw(0x9e69e2, 0x21) /usr/local/go1.12/src/runtime/panic.go:617 +0x72 fp=0xc0004e9430 sp=0xc0004e9400 pc=0x42dc92 runtime.mapaccess1_faststr(0x9343c0, 0xc00017b950, 0xc000216308, 0x13, 0x0) /usr/local/go1.12/src/runtime/map_faststr.go:21 +0x469 fp=0xc0004e94a0 sp=0xc0004e9430 pc=0x413fc9 github.com/git-lfs/git-lfs/creds.(*netrcCredentialHelper).Fill(0xc00018b0c0, 0xc00094a420, 0x0, 0xc00094a540, 0x40deb8) work/git-lfs/git-lfs/creds/netrc.go:69 +0xbc fp=0xc0004e9558 sp=0xc0004e94a0 pc=0x75000c github.com/git-lfs/git-lfs/creds.(*CredentialHelpers).Fill(0xc00094a510, 0xc00094a420, 0x0, 0x18, 0xc000216302) work/git-lfs/git-lfs/creds/creds.go:441 +0x29b fp=0xc0004e9630 sp=0xc0004e9558 pc=0x74f28b github.com/git-lfs/git-lfs/creds.(*CredentialHelperWrapper).FillCreds(0xc0004e9858, 0x0, 0x0) work/git-lfs/git-lfs/creds/creds.go:35 +0x51 fp=0xc0004e9700 sp=0xc0004e9630 pc=0x74bbb1 github.com/git-lfs/git-lfs/lfsapi.(*Client).getCreds(0xc000186a40, 0xc0002162ee, 0x8, 0x9d770c, 0x5, 0xc000581400, 0x60, 0xc000478100, 0x0, 0x0, ...) work/git-lfs/git-lfs/lfsapi/auth.go:152 +0x31b fp=0xc0004e98e0 sp=0xc0004e9700 pc=0x7bf54b github.com/git-lfs/git-lfs/lfsapi.(*Client).doWithAuth(0xc000186a40, 0xc0002162ee, 0x8, 0x9d770c, 0x5, 0xc000581400, 0x60, 0xc000478100, 0x0, 0x0, ...) work/git-lfs/git-lfs/lfsapi/auth.go:62 +0xd5 fp=0xc0004e99e0 sp=0xc0004e98e0 pc=0x7bea75 github.com/git-lfs/git-lfs/lfsapi.(*Client).DoWithAuthNoRetry(...) work/git-lfs/git-lfs/lfsapi/auth.go:46
This fix uses a mutex to synchronize access to netrcCredentialHelper.skip.