composablesys / collabs

Collabs library monorepo

Home Page:https://collabs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collection iterators and concurrent modifications

mweidner037 opened this issue · comments

Should check whether collection iterators behave rationally in the face of concurrent modification (like built-in Map and Set). If not, add warnings.

CLazyMap in particular is suspect.

Also LocalList (foundation for list CRDTs' iterators).

Addressed in #247:

  • CValueMap and CSet are probably safe, given that their iterators just iterate over a (built-in) Map , which has nice concurrent-modification behavior. Then the same holds for CMap and CValueSet.
  • Likewise for CLazyMap. However, there were potential issues if you called an iterator during a modification (e.g., in a child's event handler); I've attempted to fix these.
  • LocalList iterators (and their derivatives in the list CRDTs) are not safe and would be hard to fix. I've added a note to their class headers, plus some code that throws an error on a best-effort basis if it sees concurrent modification (like Java's ConcurrentModificationException).