2

I'm using Neo4J 2.1.5 with SDN 3.2.0.RELEASE and Spring 4.1.1.RELEASE

One repository contains a derived query:

Landscape getLandscapeByuuid(String landscapeUUID);

Intermittently (and it is -- some calls to this method return the appropriate object, some generate the error below, without any changes to the database between calls), I get a loooong Error stack trace, which starts:

Caused by: java.lang.StackOverflowError: null
at org.neo4j.kernel.impl.core.NodeImpl.getAllRelationshipsOfType(NodeImpl.java:181) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeImpl.getRelationships(NodeImpl.java:241) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.store.PersistenceCache.nodeGetRelationships(PersistenceCache.java:200) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.store.CacheLayer.nodeListRelationships(CacheLayer.java:451) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeGetRelationships(StateHandlingStatementOperations.java:903) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeGetRelationships(ConstraintEnforcingEntityOperations.java:358) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.OperationsFacade.nodeGetRelationships(OperationsFacade.java:174) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:170) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:161) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:76) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getRelationships(RelationshipHelper.java:182) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.loadRelationshipEntities(RelatedToViaCollectionFieldAccessorFactory.java:133) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.getValue(RelatedToViaCollectionFieldAccessorFactory.java:120) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyPropertiesFrom(SourceStateTransmitter.java:57) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityFetchHandler.fetchValue(Neo4jEntityFetchHandler.java:75) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityFetchHandler.fetch(Neo4jEntityFetchHandler.java:68) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl$1.doWithAssociation(Neo4jEntityConverterImpl.java:135) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.cascadeFetch(Neo4jEntityConverterImpl.java:125) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.loadEntity(Neo4jEntityConverterImpl.java:114) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.read(Neo4jEntityConverterImpl.java:104) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter.read(Neo4jEntityPersister.java:170) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.createEntityFromState(Neo4jEntityPersister.java:192) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.Neo4jTemplate.createEntityFromState(Neo4jTemplate.java:224) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.GraphBackedEntityIterableWrapper.underlyingObjectToObject(GraphBackedEntityIterableWrapper.java:41) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.GraphBackedEntityIterableWrapper.underlyingObjectToObject(GraphBackedEntityIterableWrapper.java:27) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.neo4j.helpers.collection.IterableWrapper$MyIteratorWrapper.underlyingObjectToObject(IterableWrapper.java:57) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:382) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:461) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.getValue(RelatedToViaCollectionFieldAccessorFactory.java:122) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]

(full dump at http://pastebin.com/k9iMc0cU)

Relevant domain object is Landscape -- It is very simple. I've included its superclasses and inherited interfaces also. The important question I have is... why is the above error intermittent -- what I normally see is that the first two calls to that method will generate the error, with he third and subsequent ones succeeding... some caching issues in neo4j, maybe?

public class Landscape extends GenericPublication {

    private String comments;

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }


}

public interface IPublication {

    public Set<Syndication> getSyndications();

    public String getUuid();

    public void setComments(String comments);

    public void setName(String name);

    public void setSyndications(Set<Syndication> syndications);

    public void setUuid(String uuid);

}

@NodeEntity
@XmlAccessorType(XmlAccessType.NONE)
public class GenericPublication implements IPublication {

    @Fetch
    @XmlElement
    @RelatedTo(type = "SYNDICATES_TO", direction = Direction.INCOMING)
    Set<ArticleCollection> articleCollections = new HashSet<ArticleCollection>();

    @Fetch
    @XmlElement
    String comments;

    @Fetch
    @XmlElement
    String name;

    @GraphId
    @Fetch
    Long nodeId;

    @Fetch
    @RelatedToVia(type = "SYNDICATES_TO", direction = Direction.INCOMING)
    Set<Syndication> syndications;

    @Fetch
    @XmlElement
    @Indexed
    String uuid;

    public String getComments() {
        return comments;
    }

    public String getName() {
        return name;
    }

    public Set<Syndication> getSyndications() {
        return syndications;
    }

    public String getUuid() {
        return uuid;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSyndications(Set<Syndication> syndications) {
        this.syndications = syndications;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

}

@RelationshipEntity(type = "SYNDICATES_TO")
public class Syndication {

    @GraphId
    Long nodeId;

    @Fetch
    @StartNode
    @Indexed
    ArticleCollection articleCollection;

    @Fetch
    @EndNode
    @Indexed
    GenericPublication publication;

    @Fetch
    @Indexed
    String uuid;

    @Fetch
    Set<String> categories;

    public Set<String> getCategories() {
        return categories;
    }

    public void setCategories(Set<String> categories) {
        this.categories = categories;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeId(Long nodeId) {
        this.nodeId = nodeId;
    }

    public ArticleCollection getArticleCollection() {
        return articleCollection;
    }

    public void setArticleCollection(ArticleCollection articleCollection) {
        this.articleCollection = articleCollection;
    }

    public GenericPublication getPublication() {
        return publication;
    }

    public void setPublication(GenericPublication publication) {
        this.publication = publication;
    }

}

Any ideas what's the problem here? This is such a straightforward use-case that I'm bemused where to look...

Darrell Berry
  • 203
  • 2
  • 14
  • FYI I also tried an explicit Cypher version of the derived query: `@Query("MATCH (landscape:Landscape{uuid:{landscapeUUID}}) RETURN landscape") Landscape retrieveLandscapeByUUID(@Param("landscapeUUID") String landscapeUUID);` -- that also intermittently generates the same error, so I'm guessing its something deeper down.. ideas? – Darrell Berry Oct 26 '14 at 17:11
  • Without looking deeper into this, I suspect it might be something to do with dense nodes vs nodes with a few relationships. Could you try to debug and see which nodes this happens on? See if it has many relationships? It would be useful to extract this into a test and submit an issue – Michal Bachman Oct 31 '14 at 18:08
  • You have to capitalize the property-name: getLandscapeByUuid – Michael Hunger Nov 01 '14 at 05:15
  • You should share the code of your domain objects too. – Michael Hunger Nov 01 '14 at 05:15

0 Answers0