You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "zhiwang (Jira)" <ji...@apache.org> on 2022/06/07 03:03:00 UTC

[jira] [Created] (HBASE-27093) AsyncNonMetaRegionLocator:Complete CompletableFuture in a lock may cause a deadlock

zhiwang created HBASE-27093:
-------------------------------

             Summary: AsyncNonMetaRegionLocator:Complete CompletableFuture in a lock may cause a deadlock
                 Key: HBASE-27093
                 URL: https://issues.apache.org/jira/browse/HBASE-27093
             Project: HBase
          Issue Type: Improvement
          Components: asyncclient, Client
    Affects Versions: 2.4.12, 3.0.0-alpha-2
         Environment: 2.4.12
            Reporter: zhiwang


 
{code:java}
synchronized (tableCache) {
  tableCache.pendingRequests.remove(req);
  // fail the request itself, no matter whether it is a DoNotRetryIOException, as we have
  // already retried several times
  CompletableFuture<?> future = tableCache.allRequests.remove(req);
  if (future != null) {
    future.completeExceptionally(error);
  }
  tableCache.clearCompletedRequests(null);
  // Remove a complete locate request in a synchronized block, so the table cache must have
  // quota to send a candidate request.
  toSend = tableCache.getCandidate();
  toSend.ifPresent(r -> tableCache.send(r));
}

{code}
Complete or completeExceptionally in a lock block may cause deadlock. We can put this action outside the lock block to avoid deadlock.

 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)