You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Song Ziyang (Jira)" <ji...@apache.org> on 2022/10/25 07:18:00 UTC

[jira] (RATIS-1708) RaftLog file channel closed before async flush ends

    [ https://issues.apache.org/jira/browse/RATIS-1708 ]


    Song Ziyang deleted comment on RATIS-1708:
    ------------------------------------

was (Author: JIRAUSER281912):
[~szetszwo] I observed the same problem in release 2.4.0 and checked code again. [https://github.com/apache/ratis/blob/b8117f41481f5f5861566a68bb1ea4dc7c60320c/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/BufferedWriteChannel.java#L109]

I'm not sure whether current implementation can *string up* all flush futures together, sequentially. Although the update on AtomicReference is atomic, *concurrent* update may cause flush futures to be lost?

Please take a look again, thanks!

> RaftLog file channel closed before async flush ends
> ---------------------------------------------------
>
>                 Key: RATIS-1708
>                 URL: https://issues.apache.org/jira/browse/RATIS-1708
>             Project: Ratis
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>            Reporter: Song Ziyang
>            Assignee: Song Ziyang
>            Priority: Major
>             Fix For: 3.0.0
>
>         Attachments: 746_review.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When remove a peer from current raft group, we receive flooding error message
>  
> 2022-09-13 16:31:07,877 [192.168.130.5_40010@group-000100000004-SegmentedRaftLogWorker-flush-thread1] ERROR o.a.r.s.r.s.BufferedWriteChannel:115 - Failed to flush channel
> java.nio.channels.ClosedChannelException: null
>         at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110)
>         at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:379)
>         at org.apache.ratis.server.raftlog.segmented.BufferedWriteChannel.fileChannelForce(BufferedWriteChannel.java:113)
>         at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
>  
> After checking the code, we think that the raft log is closed before asyncFlush future returns. That is, close() should wait the result in ([https://github.com/apache/ratis/blob/b7b87340b9ef5197fd751dd1a5dd1f9b68b8ffab/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/BufferedWriteChannel.java#L106)] 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)