jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Behrang Saeedzadeh <behran...@gmail.com>
Subject Getting InvalidItemStateException when invoking a simple SQL2 query
Date Tue, 02 Dec 2014 05:17:49 GMT
Hi,

In our application, when we execute the following query:

  final String statement = "SELECT * FROM [cq:PageContent] AS sites " +
                           + "WHERE ISDESCENDANTNODE([/content/myapp]) AND
sites.domainName IS NOT NULL "
                           + "ORDER BY sites.domainName";

  final Session session = resourceResolver.adaptTo(Session.class);
    final QueryManager queryManager =
session.getWorkspace().getQueryManager();
    final Query query = queryManager.createQuery("", Query.JCR_SQL2);
    final QueryResult queryResult = query.execute();

Every now and then it throws this exception pasted into this Gist:
https://gist.github.com/behrangsa/f0c61eaf029106d676b5

The relevant parts are:

Unable to compare rows:

{ sites: node 297e1b7d-8064-404f-b765-27ba71dff64a }
and
{ sites: node
/content/myapp/b9/40/04/778e826b-9ecb-4c32-abae-3f1a4a0effa2/home/jcr:content
}

org.apache.sling.engine.impl.SlingRequestProcessorImpl
        at
org.apache.jackrabbit.core.query.lucene.sort.RowComparator.compare(RowComparator.java:65)
        at
org.apache.jackrabbit.core.query.lucene.sort.RowComparator.compare(RowComparator.java:35)
        at java.util.TimSort.binarySort(TimSort.java:265)
        at java.util.TimSort.sort(TimSort.java:208)
        at java.util.TimSort.sort(TimSort.java:173)
        at java.util.Arrays.sort(Arrays.java:659)
        at java.util.Collections.sort(Collections.java:217)
        at
org.apache.jackrabbit.core.query.lucene.join.QueryEngine.sort(QueryEngine.java:625)
        at
org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:484)
        at
org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:126)
        at
org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:115)
        at
org.apache.jackrabbit.core.query.QueryObjectModelImpl$2.perform(QueryObjectModelImpl.java:129)
        at
org.apache.jackrabbit.core.query.QueryObjectModelImpl$2.perform(QueryObjectModelImpl.java:124)
        at
org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
        at
org.apache.jackrabbit.core.query.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:123)
        at
au.com.mycomp.myapp.service.sites.DefaultSiteService.getHomePageNodes(DefaultSiteService.java:169)

Caused by: javax.jcr.InvalidItemStateException: Item does not exist
anymore: 297e1b7d-8064-404f-b765-27ba71dff64a
        at
org.apache.jackrabbit.core.ItemImpl.itemSanityCheck(ItemImpl.java:116)
        at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:90)
        at
org.apache.jackrabbit.core.NodeImpl.getProperty(NodeImpl.java:2248)
        at
org.apache.jackrabbit.commons.query.qom.OperandEvaluator.getProperty(OperandEvaluator.java:502)
        at
org.apache.jackrabbit.commons.query.qom.OperandEvaluator.getProperty(OperandEvaluator.java:482)
        at
org.apache.jackrabbit.commons.query.qom.OperandEvaluator.getPropertyValues(OperandEvaluator.java:447)
        at
org.apache.jackrabbit.commons.query.qom.OperandEvaluator.getValues(OperandEvaluator.java:206)
        at
org.apache.jackrabbit.core.query.lucene.sort.RowComparator.compare(RowComparator.java:52)

As you can see, while this query is being executed, somewhere inside the
Jackrabbit codes, it wants to fetch one of the results contained
in the result and compare it with another node, but looks like by that
time, that item is already deleted by another thread or in some other
way.

Is this really the expected behavior or is this a bug? Or are there ways in
which we can prevent this from happening?

Best regards,
Behrang
http://www.behrang.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message