Describe the bug
fatal error: concurrent map read and map write
github.com/mitchellh/copystructure.Config.Copy()
└── Iterating/copying map while it's being written to concurrently
github.com/knadh/koanf/v2.(*Koanf).Get(0x1b14a3edb3b0, {0x37ae53f?, 0x4?})
github.com/knadh/koanf/[email protected]/koanf.go:353
└── BUG: Releases RLock, then calls maps.Copy(v) which iterates map
go.lumeweb.com/configmanager.(*ConfigManagerDefault).Get(0x1b14a3fee000, {0x37ae53f, 0x4}, {0x1b14a3fac180...})
go.lumeweb.com/portal/config.(*ManagerDefault).Config(0x1b14a252abb0)
go.lumeweb.com/portal/core.(*Logger).SetLevelFromConfig(0x1b14a3feae10)
go.lumeweb.com/portal.(*PortalImpl).Init(0x1b14a3feaf90)
main.main()
portal/main.go:14
To Reproduce
This is a race condition that I don't have a POC to reproduce
Expected behavior
no crash
Please provide the following information):
Additional context
The fix is to defer the ko.mu.RUnlock() in Get so that we never have unsafe access on maps.Copy(v). Additionally any other spots using maps should probably do the same.
Describe the bug
To Reproduce
This is a race condition that I don't have a POC to reproduce
Expected behavior
no crash
Please provide the following information):
Additional context
The fix is to defer the
ko.mu.RUnlock()inGetso that we never have unsafe access onmaps.Copy(v). Additionally any other spots usingmapsshould probably do the same.