From 6458a9144ea054abbf9d5fd970ade5594554ade0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 23 Dec 2022 15:02:06 +0100 Subject: [PATCH] WIP: failing randomized test SEED=175 MAX_PEERS=2 ITERATIONS=1 OPERATIONS=159 cargo test --package=collab random -- --nocapture --- Cargo.lock | 1 + crates/project/Cargo.toml | 1 + crates/project/src/project.rs | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1dfc4bc24c..6debc9eb8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4437,6 +4437,7 @@ dependencies = [ "aho-corasick", "anyhow", "async-trait", + "backtrace", "client", "clock", "collections", diff --git a/crates/project/Cargo.toml b/crates/project/Cargo.toml index dd4d2be5b6..6d6560ea38 100644 --- a/crates/project/Cargo.toml +++ b/crates/project/Cargo.toml @@ -37,6 +37,7 @@ util = { path = "../util" } aho-corasick = "0.7" anyhow = "1.0.57" async-trait = "0.1" +backtrace = "0.3" futures = "0.3" ignore = "0.4" lazy_static = "1.4.0" diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index ca1b988d05..b09c1fd267 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -4635,7 +4635,12 @@ impl Project { let is_host = collaborator.replica_id == 0; this.collaborators.insert(new_peer_id, collaborator); - if let Some(buffers) = this.shared_buffers.remove(&old_peer_id) { + let buffers = this.shared_buffers.remove(&old_peer_id); + println!( + "peer {} became {}. moving buffers {:?}", + old_peer_id, new_peer_id, &buffers + ); + if let Some(buffers) = buffers { this.shared_buffers.insert(new_peer_id, buffers); } @@ -5610,6 +5615,13 @@ impl Project { ) -> u64 { let buffer_id = buffer.read(cx).remote_id(); if let Some(project_id) = self.remote_id() { + if buffer_id == 300015 { + println!( + "creating buffer for peer {}. {:?}", + peer_id, + backtrace::Backtrace::new() + ); + } let shared_buffers = self.shared_buffers.entry(peer_id).or_default(); if shared_buffers.insert(buffer_id) { let buffer = buffer.read(cx);