runzhiwang commented on pull request #153:
URL: https://github.com/apache/incubator-ratis/pull/153#issuecomment-660562308


   > How could new AutoCloseableLock(lock, preUnlock) throw an exception?
   
   @szetszwo Thanks for review.
   
    For example, OOM happen when new AutoCloseableLock.
   
   Actually, we met deadlock in production cluster because the lock of 
DataBlockingQueue can not be free, the related jira is 
[RATIS-1004](https://issues.apache.org/jira/browse/RATIS-1004) and jstack file 
has been attached in jira.  But from the stack we can not find why the lock can 
not be free. So we want to fix all the unsafe code.
   
   Besides AutoCloseableLock is not thread safe, if anyone use it in 
multi-thread, it will also cause lock can not be free.
   
   Current patch is still not perfect, so I want to replace all `try 
(AutoCloseable Lock = AutoCloseableLock.acquire(lock))` with `try { lock.lock() 
} finally { lock.unlock()}`.
   
    What do you think ?


----------------------------------------------------------------
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.

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


Reply via email to