You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/06/07 04:14:59 UTC

[GitHub] [hbase] xiaowangzhixiao commented on pull request #4496: HBASE-27093 AsyncNonMetaRegionLocator:put Complete CompletableFuture …

xiaowangzhixiao commented on PR #4496:
URL: https://github.com/apache/hbase/pull/4496#issuecomment-1148175382

   For example, when request hbase in a outer lock, process response in this lock, and don't isolate the thread, it will cause deadlock. As the caller, we shouldn't care the lock in the hbase client.
   ```
   CompletableFuture<Result> getResult(get) {
     ....
     lock.lock();
     future = asyncTable.get(get);
     lock.unlock();
     return future;
     ...
   }
   ...
   getResult(get).handle((v,e)->{
     lock.lock();
     ...
     lock.unlock();
   });
   ```
   In getResult(), the order of lock is lock.lock() -> tableCache.lock(). But when the regionLocation response have exception, future.completeExceptionally(err) will trigger this future's handle action, and the order of lock is tableCache.lock() -> lock.lock(). So it will cause deadlock.


-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org