fix(merged_tree): introduce cycle detection to mitigate a comment bundling bug #611
No reviewers
Labels
No labels
Compat/Breaking
Kind
Bad merge
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
New language
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mergiraf/mergiraf#611
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ada4a/mergiraf:609-stack-overflow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For #609
d2e42c508d
toaa461e4e57
I had a look at the panicking test case,
examples/java/failing/successor_loop
, which triggersThis seems off: it is expected that a merged tree will contain multiple identical copies of
CommutativeChildSeparator
, which aren't symptoms of any problem.The loop detection should rather be done at the
Leader
orAstNode
level: there, I think it should indeed be a bug if we encounter the same one multiple times, although probably not if we recurse intoConflict
nodes.I'm curious how you came to the conclusion that the stack overflow comes from this particular method (I don't dispute it, but I struggle to understand how the comment bundling might lead to cycles here…)
It's been a bit since I wrote the original patch, so I don't remember all the details, but I think this method was what was repeated in the logs of the original panic, so that's what I went on to patch. But I think the bug in comment bundling just creates cycles in general, and so it might be hard to predict which particular method is going to explode because of that.
I think you're right; would you have a suggestion as to which part of the code I could put the loop detection in? What I'm thinking of is doing it right after the construction of the AST honestly, by employing one of the cycle detection algorithms
Hmm, I'm curious how that would happen. But if it does, then those would be cycles of
AstNode
s already? If that's the case, then the stack overflow would happen basically on any further transformation run on the trees, such as their matching.I don't know, I would try to find a concrete example that reaches a stack overflow and take it from there. I can run a large-scale benchmark again and try to find a fitting case.
I found an example: #609 (comment)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.