You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "slfan1989 (via GitHub)" <gi...@apache.org> on 2026/10/01 01:47:21 UTC
[PR] RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. [ratis]
slfan1989 opened a new pull request, #1617:
URL: https://github.com/apache/ratis/pull/1617
## What changes were proposed in this pull request?
`SegmentedRaftLog.close()` acquires the write lock before calling `cacheEviction.close()`, which interrupts the cache eviction thread and waits for it to terminate using `Thread.join()`.
If the eviction thread is waiting for the same write lock, a deadlock occurs:
the closing thread waits for the eviction thread to terminate, while the eviction thread waits for the closing thread to release
the lock.
Interrupting the eviction thread does not resolve this because it acquires the lock using `lock()`.
This PR moves `cacheEviction.close()` before acquiring the write lock, allowing the eviction thread to finish before the cache is cleared.
## What is the link to the Apache JIRA
RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread.
## How was this patch tested?
https://github.com/slfan1989/ratis/actions/runs/36564811620
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on PR #1617:
URL: https://github.com/apache/ratis/pull/1617#issuecomment-5937983200
@slfan1989 , thanks for working on this!
@amaliujia , thanks also for reviewing this!
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #1617:
URL: https://github.com/apache/ratis/pull/1617
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2719. SegmentedRaftLog.close may deadlock with the cache eviction thread. [ratis]
Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #1617:
URL: https://github.com/apache/ratis/pull/1617#issuecomment-5942191339
> @slfan1989 , thanks for working on this!
>
> @amaliujia , thanks also for reviewing this!
Thanks @amaliujia and @szetszwo for reviewing, and @szetszwo for merging!
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org