You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2026/10/01 18:32:45 UTC

(ratis) branch master updated: RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. (#1617)

This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 68d21674c RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. (#1617)
68d21674c is described below

commit 68d21674cc35df1078467ad19fe0975baa55b8cd
Author: slfan1989 <55...@users.noreply.github.com>
AuthorDate: Fri Oct 2 02:32:39 2026 +0800

    RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. (#1617)
---
 .../org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java
index a6ea6e3ca..e2237f9ff 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java
@@ -531,9 +531,10 @@ public final class SegmentedRaftLog extends RaftLogBase {
 
   @Override
   public void close() throws IOException {
+    // The eviction thread may need the write lock to finish, so join it before acquiring the lock.
+    cacheEviction.close();
     try(AutoCloseableLock writeLock = writeLock()) {
       super.close();
-      cacheEviction.close();
       cache.close();
     }
     fileLogWorker.close();