Azure / Azure/DotNetty

Error when calling FastThreadLocal.RemoveAll(): Collection was modified

Open
#523 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.