From 853a7abf1091ee7c168dfd3de0fbdebc135bb7f3 Mon Sep 17 00:00:00 2001 From: rkervella Date: Tue, 11 Jul 2023 12:19:16 -0700 Subject: [PATCH] Fix recursion to exclude self node --- client/command/processes/pstree.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/command/processes/pstree.go b/client/command/processes/pstree.go index 6a3e8d842f..6098e88e42 100644 --- a/client/command/processes/pstree.go +++ b/client/command/processes/pstree.go @@ -50,9 +50,16 @@ func (n *node) insert(proc *commonpb.Process) { } func (n *node) findParent(proc *commonpb.Process) *node { + // Empty node if n.Value == nil { return nil } + // Skip self when called from reorder + // otherwise things might explode, see #1340 + if n.Value.Pid == proc.Pid { + return nil + } + // Found parent if n.Value.Pid == proc.Ppid { return n }