https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

09/14/2020, 6:51 PM
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

hundreds-breakfast-49010

09/14/2020, 6:55 PM
I might try hooking up gdb using hte documentation tom wrote up: https://www.pantsbuild.org/v2.0/docs/contributions-debugging
👍 1
w

witty-crayon-22786

09/14/2020, 7:15 PM
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

hundreds-father-404

09/14/2020, 7:17 PM
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

witty-crayon-22786

09/14/2020, 7:18 PM
a deadlock would have no CPU usage, whereas an (infinite) loop would have CPU usage
h

hundreds-father-404

09/14/2020, 7:19 PM
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

witty-crayon-22786

09/14/2020, 7:19 PM
yep.
h

hundreds-father-404

09/14/2020, 7:20 PM
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

witty-crayon-22786

09/15/2020, 4:26 PM
i’ve seen that exact issue at least three times. i did it once, benjy another time, and now you… heh
1
h

hundreds-father-404

09/15/2020, 4:30 PM
Sounds like something Clippy should check for!!
w

witty-crayon-22786

09/15/2020, 4:30 PM
the first two cases were in python
👀 1
h

hundreds-father-404

09/15/2020, 4:31 PM
Huh, how did you do that in Python? Usually you don’t explicitly create the iterator
w

witty-crayon-22786

09/15/2020, 4:32 PM
“while parent is not empty”
👍 1