What happened:
When two clients simultaneously attach to a new document using Attach with InitialRoot, a scenario occurs where one element is not added to gcElementPairMap, resulting in two elements existing concurrently in root.ElementsMapByCreatedAt without the expected mapping in root.gcElementPairMap.
What you expected to happen:
Only one instance of the alive element should exist in Root.ElementsMapByCreatedAt, with proper mapping in root.gcElementPairMap.
How to reproduce it (as minimally and precisely as possible):
- Use two clients to simultaneously attach to a new document with
Attach with InitialRoot. (codemirror example in yorkie-js-sdk, etc)
- Observe the
root.ElementsMapByCreatedAt and root.gcElementPairMap post-attachment.
Anything else we need to know?:
This appears to be a concurrency handling issue, and further investigation is necessary to determine the root cause.
Environment:
- Operating system:
- Browser and version:
- Yorkie version: v0.6.14
- Yorkie JS SDK version: v0.6.14