You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
export(updates_in_range) panics with several non-contiguous spans of one peer #1155
LoroDoc::export(ExportMode::updates_in_range(spans)) panics with counter should be continuous (crates/loro-internal/src/oplog/change_store.rs:1000, ChangeStore::insert_change_inner, reached via export_blocks_in_range) when spans holds two or more non-contiguous spans of the same peer. The panic happens while the oplog lock is held, so the doc is poisoned afterwards (and in WASM the instance traps).
Found during the adversarial review of #1125. Not caused by #1125, and not fixed there.
Minimal repro (main 1eb14b3b)
use loro::{ExportMode,IdSpan,LoroDoc};let doc = LoroDoc::new();
doc.set_peer_id(1).unwrap();let text = doc.get_text("t");for i in0..10{
text.insert(i,"a").unwrap();
doc.commit();}// panics: counter should be continuous
doc.export(ExportMode::updates_in_range(vec![IdSpan::new(1,0,2),IdSpan::new(1,5,7),]));
Expected
Either export both ranges, or return Err for spans the export cannot represent. It should not panic.
Notes
A single span, or spans of different peers, work. The export path inserts the selected changes into a temporary change store, and that store requires each peer's counters to be contiguous.
Activity
fix: export several non-contiguous spans of one peer in updates_in_ra…
fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154