diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java index e46a50e76199..c26ebdcdfcb0 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java @@ -1148,7 +1148,15 @@ private String buildDetailedErrorMsg(String string, int index) { @Override public void waitUntilDone() throws InterruptedIOException { try { - waitUntilDone(Long.MAX_VALUE); + if (this.operationTimeout > 0) { + // the worker thread maybe over by some exception without decrement the actionsInProgress, + // then the guarantee of operationTimeout will be broken, so we should set cutoff to avoid + // stuck here forever + long cutoff = (EnvironmentEdgeManager.currentTime() + this.operationTimeout) * 1000L; + waitUntilDone(cutoff); + } else { + waitUntilDone(Long.MAX_VALUE); + } } catch (InterruptedException iex) { throw new InterruptedIOException(iex.getMessage()); } finally {