nfsantos commented on code in PR #2410: URL: https://github.com/apache/jackrabbit-oak/pull/2410#discussion_r2250353374
########## oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/ElasticResultRowAsyncIterator.java: ########## @@ -176,7 +214,10 @@ public boolean on(Hit<ObjectNode> searchHit) { @Override public void endData() { try { - queue.put(POISON_PILL); + boolean success = queue.offer(POISON_PILL, enqueueTimeoutMs, TimeUnit.MILLISECONDS); + if (!success) { + LOG.warn("Timeout waiting to insert poison pill into the iterator queue. The iterator might not be closed properly."); Review Comment: `endData()` is called from two locations: - `ElasticInsecureFacetAsyncProvider.on` - This is called at the end of the results, so there will be no more calls to the iterator. And if we throw an exception here, it will be swallowed by the driver as it executes on the event handling thread of the driver. - `ElasticQueryScanner.close` - The scanner is closing, so any further calls to `hasNext()` will see `isClosed` set to true and will no try to read from the queue. I prefer to leave it just as a warning, as throwing an exception could lead to unexpected results. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org