Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

StackOverflowError when using both incoming and outgoing relationships on the same node due to very deep recursive mapping #3039

Closed as not planned
Assignees
@duwenice

Description

We encountered a problem in Spring Data Neo4j when a domain entity contains both incoming and outgoing relationships, and the query returns a deeply nested / complex graph structure (with the same nodes being connected through multi-level in/out relationships).

In such cases, the DefaultNeo4jEntityConverter recursively resolves the relationships and keeps creating nested entities.
When the returned subgraph is deep enough, the recursive mapping ends up consuming too many stack frames and eventually causes a java.lang.StackOverflowError.

Image

@query("""
MATCH (c:analyzer)
WHERE c.id IN 0ドル
CALL apoc.path.subgraphAll(c, {
relationshipFilter: 'child>',
maxLevel: 1ドル
})
YIELD nodes, relationships
UNWIND nodes AS node
OPTIONAL MATCH (node)-[r:child]->(a:analyzer)
RETURN node, collect(r),collect(a)
""")
List findAllChildren(Set tableIds, int maxLevel);

public class TableNode extends HiBaseNode {

@Relationship(type = Neo4jConstants.RelationShip.CHILD, direction = Relationship.Direction.INCOMING)
private Set<TableNode> parentNodes;
@Relationship(type = Neo4jConstants.RelationShip.CHILD)
private Set<TableNode> childNodes;

}

We observed that after increasing the JVM thread stack size (-Xss) the conversion succeeds, which indicates that the problem is caused by deep recursion during property filling.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /