I iterated over a Dict in the loop.
The documentation states:
Base collection types require manual locking if used simultaneously by multiple threads where at least one thread modifies the collection (common examples include
push!on arrays, or inserting items into aDict).
I switched to a simple vector, which resolved the issue.