Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1708

RaftLog file channel closed before async flush ends

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 3.0.0, 2.4.1
    • None
    • None

    Description

      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) 

      Attachments

        1. 746_review.patch
          7 kB
          Tsz-wo Sze

        Issue Links

          Activity

            People

              William Song Song Ziyang
              William Song Song Ziyang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m