Github user gesterzhou commented on a diff in the pull request: https://github.com/apache/geode/pull/451#discussion_r111261018 --- Diff: geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java --- @@ -132,6 +133,25 @@ private LuceneIndexImpl getLuceneIndex(final Region region, try { index = (LuceneIndexImpl) service.getIndex(searchContext.getIndexName(), region.getFullPath()); + if (index == null && service instanceof LuceneServiceImpl) { + if (((LuceneServiceImpl) service).getDefinedIndex(searchContext.getIndexName(), + region.getFullPath()) != null) { + // The node may be in the process of recovering, where we have the index defined but yet + // to be recovered + // If we retry fast enough, we could get a stack overflow based on the way function + // execution is currently written + // Instead we will add an artificial sleep to slow down the retry at this point + // Hopefully in the future, the function execution would retry without adding to the stack + // and this can be removed + try { --- End diff -- Is sleep 100 ms enough? How about using a 10 seconds timeout, but check if it's ready every 100ms?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---