133tosakarin commented on PR #1168: URL: https://github.com/apache/ratis/pull/1168#issuecomment-2421296617
Consider a real-world scenario: The leader, while executing **synchronized changeToFollower(...)**, calls future.join() to wait for all logAppender tasks to complete. However, at that moment, the logAppender might already be blocked, waiting to acquire the lock held by changeToFollower. This situation leads to a deadlock. Previously, we made a change to return a future from the shutdown method (it didn't have a return value before), but we overlooked an important aspect: the fact that synchronized is reentrant. Even if we release the lock held at the changeToFollower level, the upper-layer locks are still in place. Therefore, we need to ensure that all upper-layer locks are fully released before executing future.join. -- 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]
