Apache9 commented on PR #4496:
URL: https://github.com/apache/hbase/pull/4496#issuecomment-1148175987
> 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.
OK, typical usage, sound reasonable.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]