itschrispeck opened a new pull request, #13360: URL: https://github.com/apache/pinot/pull/13360
I introduced `ScalingThreadPoolExecutor` previously to provide an autoscaling thread pool, used to prevent interrupts from corrupting the realtime Lucene index. There is a race condition as the logic relied on `_executor.getPoolSize()` and `_executor.getActiveCount()`. This PR changes the implementation slightly to track idle threads via overriding the [two methods that may be used by ThreadPoolExecutor.getTask()](https://github.com/openjdk/jdk21/blob/890adb6410dab4606a4f26a942aed02fb2f55387/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java#L1069-L1070), which is always executed by an idle thread to pick up the next task. In theory this could cause sporadic timeouts for searches against the realtime Lucene index, though it is hard to reproduce. I came across this bug trying to use `ScalingThreadPoolExecutor` for another feature. For testing, unit tests should cover this logic. The race condition is easily reproducible when the added unit test is used against the old implementation. suggested tag: `bugfix` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
