From c6d752431a323a27d962a3456de6a7d9a1df5888 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Wed, 9 Oct 2024 19:56:35 +1100 Subject: [PATCH] reenable plainactionfuture assertion --- .../action/support/PlainActionFuture.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java b/server/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java index e4121297f3689..d35e502a9c4ec 100644 --- a/server/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java +++ b/server/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java @@ -20,6 +20,8 @@ import org.elasticsearch.common.util.concurrent.UncategorizedExecutionException; import org.elasticsearch.core.Nullable; import org.elasticsearch.core.TimeValue; +import org.elasticsearch.logging.LogManager; +import org.elasticsearch.logging.Logger; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.Transports; @@ -31,6 +33,7 @@ import java.util.concurrent.locks.AbstractQueuedSynchronizer; public class PlainActionFuture implements ActionFuture, ActionListener { + private static final Logger logger = LogManager.getLogger(PlainActionFuture.class); @Override public void onResponse(@Nullable T result) { @@ -39,7 +42,12 @@ public void onResponse(@Nullable T result) { @Override public void onFailure(Exception e) { - // assert assertCompleteAllowed(); + try { + assert assertCompleteAllowed(); + } catch (AssertionError ae) { + logger.info("--> AssertionError while onFailure", e); + throw ae; + } if (sync.setException(Objects.requireNonNull(e))) { done(false); }