Repository navigation
Add lock to RegisterVariantCollection - #7077
Conversation
|
This looks pretty suss as any number of methods above it will explode without thread-safety? |
Doubt it, each worker only edits node from the file it parsed, kindData is shared and unfrozenVariants is the only shared thing extractMapping writes to. Honestly the chances of this happening are pretty low anyways, I was more curious and wanted to look into it. will just close and if it comes up again later for whatever reason someone can see here. |
|
Reopening this, since it's an issue |
metalgearsloth
left a comment
There was a problem hiding this comment.
Also needs release note.
DrSmugleaf
left a comment
There was a problem hiding this comment.
Might be better to use a concurrent dictionary for this, at least from my experience in serialization code they are faster
Either way note below if you choose not to
Not sure if concurrent would be faster after initialization and freezing are included. If you want I can spend some time trying to get some benchmarks. Would also mean making the initalization support threading but w/e |
Probably fine to leave it be, either way it will come up in a future profile if it's an issue |
Adds a lock around
RegisterVariantCollectionso that parallel prototype loading can't corruptKindData.UnfrozenVariants.RobustToolbox/Robust.Shared/Prototypes/PrototypeManager.cs
Lines 1253 to 1258 in a80d4d0
The issue is with this dict getting a null key, which it can't have, so thats bad.
Resolves #7199
Was a race condition before, but obviously if you run a million races it will hit eventually.