Open
Description
Here is some working code with AutoCommit
pub fn log_draft(editor: RustOpaque<Mutex<LocalEditor>>) -> Result<()> {
let mut editor = editor.lock().unwrap();
let LocalEditor { doc, .. } = &mut *editor;
let mut demo: DemoSchema = hydrate(doc).unwrap();
demo.draft
.splice(0, demo.draft.as_str().chars().count() as isize, "");
demo.edit_counter.increment(1);
reconcile(doc, demo)?;
Ok(())
}
If I change the type of the doc from AutoCommit to Automerge, and use a transaction:
let mut editor = editor.lock().unwrap();
let LocalEditor { doc, .. } = &mut *editor;
let mut demo: DemoSchema = hydrate(doc).unwrap();
demo.draft
.splice(0, demo.draft.as_str().chars().count() as isize, "");
demo.edit_counter.increment(1);
let mut tx = doc.transaction();
reconcile(&mut tx, demo)?;
let _ = tx.commit();
Ok(())
}```
I am seeing StaleHeads exception on a certain synchronization flow.
I wish I had a clean repro, but I don't. I was seeing the error with the Automerge code, but not with the AutoCommit code, in the following scenario on a wasm build. I'm happy to work with you over Slack on chasing it down if you're interested.
Client 1: Make edit A, sync protocol until quiescent. (heads are now, say, ["1234"])
Client 2: Sync protocol, edit B, sync protocol (heads are now ["5678"])
Client 1: Edit C -> fails on reconcile with StaleHeads. Expected heads are ["9abc"], actual heads are ["9abc", "5678"]
Metadata
Metadata
Assignees
Labels
No labels
Activity