Closed anderseknert closed 1 month ago
I can't seem to replicate this, but here is my theory. This code safely gets all the refs, however this function (GetAllFileRefs) only returns a reference to the map.
for file, refs := range c.GetAllFileRefs()
Then while we loop over it, there's an update to the underlying contents creating this issue. I think that the same issue could have happened in GetAllBuiltInPositions
, GetAllModules
& GetAllFiles
, as well as GetAllFileRefs
.
I think that the fix here is to, for these functions, return a copy of the underlying map instead.
https://github.com/StyraInc/regal/pull/760 would be a fix if this we agree on this being the cause.
Sadly, I'm not 100% sure what I did to cause this, as I was frantically testing different things trying to break completions, and while I succeeded in that, I'm not sure exactly what caused the breakage. But it looks like we need a lock somewhere we don't.