[MGNLREST-137] Avoid infinite loop in reference resolver: A ref to B, then B ref back to A Created: 30/Oct/17  Updated: 13/Nov/17  Resolved: 08/Nov/17

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0

Type: Bug Priority: Critical
Reporter: Sang Ngo Huu Assignee: Sang Ngo Huu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 5.5h
Time Spent: 1d 2.5h
Original Estimate: 2d

Issue Links:
duplicate
duplicates MGNLREST-139 Circular references cause stack overflow Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: REST References
Sprint: Saigon 120, Saigon 121
Story Points: 5

 Description   

The system must have safeguards against this problem "Cause infinite loop if we had A ref to B, then B ref to A.". The original node should never be "resolved" again.
Or, it would need to be that ANY parent in a resolution "tree" should never be resolved again.

To reproduce:

1. Change a story to reference another story in such a way as to cause a circular reference, for example configure "flavors of asia" to point to itself.

2.Configure delivery endpoint as follows:

  stories:
    depth: 0
    includeSystemProperties: true
    bypassWorkspaceAcls: true
    rootPath: /stories-demo
    nodeTypes:
      0: mgnl:composition
    limit: 1
    references:
      tours:
        propertyName: stories
        referenceResolver:
          implementationClass: info.magnolia.rest.reference.jcr.UuidReferenceResolver
          targetWorkspace: stories

3. Request endpoint.

Result: Stack overflow.



 Comments   
Comment by Dai Ha [ 09/Nov/17 ]

verify with magnolia-enterprise-pro-demo-bundle-5.6-20171108.165820-202-tomcat-bundle.zip
endpoint works in both case: A ref B | B ref A, C ref C.

Generated at Mon Feb 12 06:56:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.