A user reported that they had a thread stuck inside of the while loop in FlowGraphTable.Row.addTreeSibling and sent me a Pipeline flow graph that could reproduce the issue. With that, I was able to figure out the proximate cause (the flow graph was corrupted), although I am still not sure about the root cause (how and why the flow graph became corrupted). Here is a simplified form of the structure of the flow graph in question, the sh step is the problematic node:
The problem is that the sh step is the parent of the end of a parallel step, but somehow also the parent of additional steps. FlowGraphTable doesn't expect the graph to have a structure like this so things break. The build was manually aborted while the parallel branches were executing, yet somehow branch 3 continued executing despite the end node for the parallel step being linked to one of the nodes in that branch. I don't have access to Jenkins system logs from when the build was executed to know if there were any warnings. The Pipeline in question looks relatively normal (there aren't nested parallels or anything like that).
I am not sure how this could happen, and I wasn't able to reproduce the issue from scratch.
I think it's reasonable to make FlowGraphTable throw an exception for a corrupted graph like this to avoid infinite loops.