Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Oak:indexing traversal exception

Avatar

Level 3

Hi,

When I run a query in Query Performance Tool, i am getting a RunTimeTraversalException in logs.

I checked the query in the OAK Index Query generator, its suggested to create a Lucene index with node type nt:base and there is no properties indicated.

Beaula123_0-1712553699208.png

 

I used the OOTB ntBaseLucene index as it also targeting same node typa nt:base and reindexed.

Still the traversal exception is not fixed. Please suggest.

 

org.apache.jackrabbit.oak.query.RuntimeNodeTraversalException: The query read or traversed more than 3000000 nodes. To avoid affecting other tasks, processing was stopped.
at org.apache.jackrabbit.oak.query.FilterIterators.checkReadLimit(FilterIterators.java:70) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor.fetchNext(Cursors.java:341) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor.next(Cursors.java:320) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.query.ast.SelectorImpl.nextInternal(SelectorImpl.java:520) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.query.ast.SelectorImpl.next(SelectorImpl.java:508) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.fetchNext(QueryImpl.java:876) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.hasNext(QueryImpl.java:903) [org.apache.jackrabbit.oak-core:1.22.16]
at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.fetch(QueryResultImpl.java:186) [org.apache.jackrabbit.oak-jcr:1.22.16]
at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.<init>(QueryResultImpl.java:181) [org.apache.jackrabbit.oak-jcr:1.22.16]
at org.apache.jackr

6 Replies

Avatar

Community Advisor

Hi @Beaula123 
Could you please share your requirement for the query.

with nt:base type, it will parse all the node. you need to optimize your query first.



Arun Patidar

Avatar

Level 3

Hi @arunpatidar ,

 

Here is the query

select [jcr:path], [jcr:score], * from [nt:base] as a where contains(*, '"/content/ssh-server-user-exp.dita"') /* xpath: //*[jcr:contains(., '"/content/ssh-server-user-exp.dita"')] */

 

Avatar

Community Advisor

Is this OOTB query or are you trying to create a query for some use case, if yes, then please explain the use case.

writing bad queries can lead to above exceptions.



Arun Patidar

Avatar

Community Advisor

@Beaula123 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community



Esteban Bustamante

Avatar

Level 3

@arunpatidar , @EstebanBustamante ,

We are still facing the issues with the traversal queries and these are causing the high CPU utilization in the publishers. 

The see below WARN messages in the publisher logs and these causing the pipeline failure in the performance testing.

16.04.2024 06:48:18.332 *WARN* [sling-default-5-com.day.cq.statistics.impl.StatisticsServiceImpl.2492] org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor Traversed 98000 nodes with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:base] as a where [jcr:content/cq:keywords] is not null and isdescendantnode(a, '/') /* xpath: /jcr:root//*[jcr:content/@cq:keywords] */, path=//*, property=[jcr:content/cq:keywords=[is not null]]); consider creating an index or changing the query
16.04.2024 06:48:20.169 *WARN* [sling-default-5-com.day.cq.statistics.impl.StatisticsServiceImpl.2492] org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor Traversed 99000 nodes with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:base] as a where [jcr:content/cq:keywords] is not null and isdescendantnode(a, '/') /* xpath: /jcr:root//*[jcr:content/@cq:keywords] */, path=//*, property=[jcr:content/cq:keywords=[is not null]]); consider creating an index or changing the query
16.04.2024 06:48:21.188 *WARN* [sling-default-5-com.day.cq.statistics.impl.StatisticsServiceImpl.2492] org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor Traversed 100000 nodes with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:base] as a where [jcr:content/cq:keywords] is not null and isdescendantnode(a, '/') /* xpath: /jcr:root//*[jcr:content/@cq:keywords] */, path=//*, property=[jcr:content/cq:keywords=[is not null]]); consider creating an index or changing the query
16.04.2024 06:48:22.768 *WARN* [sling-default-5-com.day.cq.statistics.impl.StatisticsServiceImpl.2492] org.apache.jackrabbit.oak.query.FilterIterators The query read or traversed more than 100000 nodes.
org.apache.jackrabbit.oak.query.RuntimeNodeTraversalException: The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.
	at org.apache.jackrabbit.oak.query.FilterIterators.checkReadLimit(FilterIterators.java:70) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor.fetchNext(Cursors.java:341) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor.next(Cursors.java:320) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.query.ast.SelectorImpl.nextInternal(SelectorImpl.java:520) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.query.ast.SelectorImpl.next(SelectorImpl.java:508) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.fetchNext(QueryImpl.java:876) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.hasNext(QueryImpl.java:903) [org.apache.jackrabbit.oak-core:1.22.16]
	at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.fetch(QueryResultImpl.java:186) [org.apache.jackrabbit.oak-jcr:1.22.16]
	at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.<init>(Que

  Please suggest a quick fix for this.

Avatar

Community Advisor

@Beaula123, you didn't provide the information that @arunpatidar has requested for guiding you. Essentially, the issue you are facing arises because this query is not performant. Typically, you would optimize your query by specifying limits such as changing the type of node being queried, limiting the path, limiting the properties, etc. Additionally, adding an index is crucial; using the OAK Index Query generator is not a silver bullet. If this is an out-of-the-box query, consulting Adobe directly by raising a support ticket is also a valid option. Again, since this information wasn't provided as Arun requested, it's difficult to provide further advice.

 

Hope this helps.



Esteban Bustamante