You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2022/03/29 06:53:44 UTC

[GitHub] [jackrabbit-oak] thomasmueller commented on a change in pull request #530: Add check for StackOverflowError

thomasmueller commented on a change in pull request #530:
URL: https://github.com/apache/jackrabbit-oak/pull/530#discussion_r837113921



##########
File path: oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/IndexName.java
##########
@@ -233,16 +233,21 @@ public String nextCustomizedName() {
     private static boolean isIndexActive(String indexPath, NodeState rootState) {
         // An index is active if it has a hidden child node that starts with ":oak:mount-",
         // OR if it is an active merged index
-        NodeState indexNode = rootState;
-        for(String e : PathUtils.elements(indexPath)) {
-            indexNode = indexNode.getChildNode(e);
-        }
-        for(String c : indexNode.getChildNodeNames()) {
-            if (c.startsWith(":oak:mount-")) {
-                return true;
+        try {
+            NodeState indexNode = rootState;
+            for (String e : PathUtils.elements(indexPath)) {
+                indexNode = indexNode.getChildNode(e);
             }
+            for (String c : indexNode.getChildNodeNames()) {
+                if (c.startsWith(":oak:mount-")) {
+                    return true;
+                }
+            }
+            return isIndexActiveMerged(indexNode, rootState);
+        } catch (StackOverflowError e) {
+            LOG.error("Fail to check index activeness for {} with error {}", indexPath, e);
         }
-        return isIndexActiveMerged(indexNode, rootState);
+        return true;

Review comment:
       OK, so if we get a StackOverflowError, then the index is marked active... This is OK in my view. I think it would be clearer if the "return" is moved into the "catch" part.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org