DotNetty
DotNetty copied to clipboard
Error when calling FastThreadLocal.RemoveAll(): Collection was modified
https://github.com/Azure/DotNetty/blob/47f5ec7303037f1360615d182939e04d8619a2b3/src/DotNetty.Common/FastThreadLocal.cs#L32
I think that comment is unpleasantly true, you will need to create a clone as you're removing items from the collection that you're iterating over...
This is what I'm seeing (it seems as this only occurs upon the second call):
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.HashSet`1.Enumerator.MoveNext()
at DotNetty.Common.FastThreadLocal.RemoveAll()
Other threads are modifying Collection, either with a for implementation or a new List reserved deleted object, and then call List remove to delete the implementation