We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug SidecarEgressMap.Get() throws concurrent map access error intermittently. The map access inside the func is not thread-safe.
admiral/admiral/pkg/controller/common/types.go
Line 179 in 72d5ec4
Steps To Reproduce This error is pretty intermittent. I wrote a test to reproduce this error.
func TestSidecarEgressGet(t *testing.T) { egressMap := NewSidecarEgressMap() egressMap.Put("pkey1", "pkey2", "fqdn", map[string]string{"pkey2": "pkey2"}) ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(5*time.Second)) defer cancel() go func(ctx context.Context) { for { select { case <-ctx.Done(): return default: egressMap.Put("pkey1", string(uuid.NewUUID()), "fqdn", map[string]string{"pkey2": "pkey2"}) } } }(ctx) for { select { case <-ctx.Done(): return default: assert.NotNil(t, egressMap.Get("pkey1")) } } }
Error:
fatal error: concurrent map read and map write goroutine 10 [running]: runtime.throw({0x181ef9c, 0xc000495980}) /Users/ssharma34/shriram/sandbox/goroots/go1.17/src/runtime/panic.go:1198 +0x71 fp=0xc000083e70 sp=0xc000083e40 pc=0x1036df1 runtime.mapaccess1_faststr(0xc0001127e0, 0xc000203a00, {0x180b471, 0x5}) /Users/ssharma34/shriram/sandbox/goroots/go1.17/src/runtime/map_faststr.go:21 +0x3a5 fp=0xc000083ed8 sp=0xc000083e70 pc=0x1014045 github.com/istio-ecosystem/admiral/admiral/pkg/controller/common.(*SidecarEgressMap).Get(...) /Users/ssharma34/shriram/personal/github/admiral/admiral/pkg/controller/common/types.go:180
Expected behavior Have a mutex around the map for synchronized access.
The text was updated successfully, but these errors were encountered:
Fixes istio-ecosystem#219
6663b3f
Added mutex to sync access to the SidecarEgressMap
648a11a
Added mutex to sync access to the SidecarEgressMap Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
88bfac1
Successfully merging a pull request may close this issue.
Describe the bug
SidecarEgressMap.Get() throws concurrent map access error intermittently.
The map access inside the func is not thread-safe.
admiral/admiral/pkg/controller/common/types.go
Line 179 in 72d5ec4
Steps To Reproduce
This error is pretty intermittent. I wrote a test to reproduce this error.
Error:
Expected behavior
Have a mutex around the map for synchronized access.
The text was updated successfully, but these errors were encountered: