<https://github.com/pantsbuild/pants/pull/10760> r...
# development
h
https://github.com/pantsbuild/pants/pull/10760 results in a hang when running
./pants test
đź‘€ Do we have a technique to see where the hang is happening, like what rule and/or line of Rust code
h
I might try hooking up gdb using hte documentation tom wrote up: https://www.pantsbuild.org/v2.0/docs/contributions-debugging
đź‘Ť 1
w
might also cherry-pick and enable https://github.com/pantsbuild/pants/pull/10734
are you able to repro it locally? would first want to see whether it is a deadlock or an infinite loop
h
Yes, I can repro it locally. And I didn’t encounter it yesterday before making some refactors, so I think we could isolate the couple lines of diff that cause it
w
a deadlock would have no CPU usage, whereas an (infinite) loop would have CPU usage
h
For that, would you look at something like
top
to see %CPU? I really don’t yet have a good intuition for how to debug something like this
w
yep.
h
Cool. (Aside, I recently downloaded a bunch of Rust rewrites of classic tools. https://zaiste.net/posts/shell-commands-rust/
bat
is an awesome rewrite of
cat
, and
ytop
looks cool too)
đź‘Ť 1
Infinite loop, hehe:
Copy code
diff --git a/src/rust/engine/fs/store/src/snapshot_ops.rs b/src/rust/engine/fs/store/src/snapshot_ops.rs
index ad696ae55..092c470a3 100644
--- a/src/rust/engine/fs/store/src/snapshot_ops.rs
+++ b/src/rust/engine/fs/store/src/snapshot_ops.rs
@@ -665,7 +665,8 @@ pub trait SnapshotOps: StoreWrapper + 'static {
     prefix: RelativePath,
   ) -> Result<Digest, SnapshotOpsError> {
     let prefix: PathBuf = prefix.into();
-    while let Some(parent) = prefix.iter().next_back() {
+    let mut prefix_iter = prefix.iter();
+    while let Some(parent) = prefix_iter.next_back() {
       let mut dir_node = remexec::DirectoryNode::new();
       dir_node.set_name(osstring_as_utf8(parent.to_os_string())?);
       dir_node.set_digest((&digest).into());
w
i’ve seen that exact issue at least three times. i did it once, benjy another time, and now you… heh
âť— 1
h
Sounds like something Clippy should check for!!
w
the first two cases were in python
đź‘€ 1
h
Huh, how did you do that in Python? Usually you don’t explicitly create the iterator
w
“while parent is not empty”
đź‘Ť 1