Skip to content

Commit

Permalink
Fix Race in Closing IndicesService.CacheCleaner (#42016) (#42052)
Browse files Browse the repository at this point in the history
* When close becomes true while the management pool is shut down, we run
into an unhandled `EsRejectedExecutionException` that fails tests
* Found this while trying to reproduce #32506
   * Running the IndexStatsIT in a loop is a way of reproducing this
  • Loading branch information
original-brownbear authored May 10, 2019
1 parent 906999f commit dc444ce
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.concurrent.AbstractRefCounted;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
import org.elasticsearch.common.util.iterable.Iterables;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
Expand Down Expand Up @@ -1225,7 +1226,13 @@ public void run() {
}
// Reschedule itself to run again if not closed
if (closed.get() == false) {
threadPool.schedule(this, interval, ThreadPool.Names.SAME);
try {
threadPool.schedule(this, interval, ThreadPool.Names.SAME);
} catch (EsRejectedExecutionException e) {
if (closed.get() == false) {
throw e;
}
}
}
}

Expand Down

0 comments on commit dc444ce

Please sign in to comment.