yorkie-team / yorkie-js-sdk

Yorkie JavaScript SDK
https://yorkie.dev/docs/js-sdk
Apache License 2.0
137 stars 90 forks source link

Error `document not attached` occurs when Detach and Sync race #856

Open chacha912 opened 2 months ago

chacha912 commented 2 months ago

What happened:

Error document not attached occurs when going backwards in codepair. This error occurs due to a race condition between Detach and Sync requests. Since a sync loop is performed independently of a detach, the client may send a sync request while the document is still considered attached before receiving a response to the detach request. This causes an error on the server because it has already processed the detach request and considers the document detached.

image

What you expected to happen:

The Detach and Sync requests should not race to avoid the document not attached error.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

jeonghye-choi commented 1 month ago

I'm interested in this issue. Can I give it a shot?

blurfx commented 1 month ago

Sure :)