Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug generating flame graphs with deep stacks
When a stack becomes too deep, the flame graph reporter cuts off the stack and just displays a node with "<STACK TOO DEEP>" as the name. Up until now, all such nodes would share the same dict of child nodes. This was usually fine, because we should never attempt to add child nodes below a node that was already too deep. However, subtly, if there were several different call stacks that led to the too-deep node, and they differed only in ignored CPython-internal frames, and they had a different number of ignored frames, then it was possible that the same node in our tree, when reached by two different paths, would be found at two different depths. If a later call found the same node at a shallower depth, we would try to add children to it, modifying the children of all of the too-deep nodes. Fix both of these problems. Stop assigning the same dict to every too-deep node, and instead just use the empty dict of children that it already holds. Also, stop counting skipped frames towards our depth limit. This removes any risk of us adding nodes below a node that was already too deep in the future, and also ensures that all of the marker nodes for a truncated stack appear at the same depth in the flame graph. Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
- Loading branch information