Skip to content

Conversation

@zxch3n
Copy link
Member

@zxch3n zxch3n commented Nov 29, 2024

Fix the dead loop issue here: https://gist.github.com/sunflowerdeath/c0e2b46b6f5d2e32d368f8e04f730237

Reason for the Dead Loop in find_common_ancestor

Original Assumptions

  1. Dependency Assumption

    If a DagNode is depended upon by other nodes, the direction of this dependency will only point to before the end of the node. This assumption is used in system design.

  2. Node Overlap Assumption

    DagNodes do not overlap with each other. When retrieving DagNodes from two different positions:

    • They are either completely identical
    • Or they do not overlap at all
    • If there is overlap, it means they are the same node

Current Issues

  1. Issues Caused by Lazy Loading

    Due to the use of lazy loading, new situations have arisen. Initially:

    • A certain DagNode is not depended upon by other DagNodes
    • Therefore, the initially retrieved form is complete
  2. Impact of Subsequent Loading

    After loading additional DagNodes:

    • The newly loaded DagNode may depend on the internal position of the previously complete DagNode
    • This causes the originally complete DagNode to be split into multiple smaller DagNodes
  3. Violation of Original Assumptions

    In this case, when retrieving the content of the original DagNode again:

    • Other DagNode dependencies may appear in the middle
    • There may be overlaps on the DagNode
    • This violates the original design assumptions

Fix Approach

Remove the assumption in the original implementation that "overlapping DagNodes will not occur." When overlapping DagNodes are found, retain the shorter one and remove the longer one.

@zxch3n zxch3n changed the title fix dead loop fix: dead loop when importing updates Nov 29, 2024
@zxch3n zxch3n assigned zxch3n and unassigned Leeeon233 Nov 29, 2024
@zxch3n zxch3n requested a review from Leeeon233 November 29, 2024 04:25
@zxch3n zxch3n merged commit 0325061 into main Nov 29, 2024
1 check passed
@zxch3n zxch3n deleted the fix-dead-loop branch November 29, 2024 05:01
@github-actions github-actions bot mentioned this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants