Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4844

Fail-slow disk while executing writeLongToFile can cause the follower to hang

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.10.0
    • None
    • server
    • None

    Description

      Symptom:If a thread is doing a file write and stuck in writeLongToFile, this thread will hang. This blocking shoud be handled by the zookeeper via PING.  However, if the QuorumPeer executes the writeLongToFile and encounters a fail-slow disk, the entire follower can be stuck. The leader will abandon this follower, but the follower believes that it is a follower.

      Callstack is as following:

      at org.apache.zookeeper.common.AtomicFileOutputStream.write(AtomicFileOutputStream.java:72)    
      at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)    
      at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)    
      at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)    
      at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)   
      at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)    
      at java.io.BufferedWriter.flush(BufferedWriter.java:254)    
      at org.apache.zookeeper.common.AtomicFileWritingIdiom.<init>(AtomicFileWritingIdiom.java:72)    
      at org.apache.zookeeper.common.AtomicFileWritingIdiom.<init>(AtomicFileWritingIdiom.java:54)    
      at org.apache.zookeeper.server.quorum.QuorumPeer.writeLongToFile(QuorumPeer.java:2233)    
      at org.apache.zookeeper.server.quorum.QuorumPeer.setAcceptedEpoch(QuorumPeer.java:2262)    
      at org.apache.zookeeper.server.quorum.Learner.registerWithLeader(Learner.java:510)    
      at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:91)    
      at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:1556) 

      Root cause: The Quorum is blocked in writeLongToFile and can not execute readPacket, so no timeout exception is arised to trigger the error handler.

      Moreover, this  problem cannot be handle by add "-Dlearner.asyncSending=true"(https://issues.apache.org/jira/browse/ZOOKEEPER-4074)

      Attachments

        1. system1.log
          53 kB
          mutu
        2. system2.log
          75 kB
          mutu
        3. system3.log
          57 kB
          mutu
        4. systemAsync1.log
          75 kB
          mutu
        5. systemAsync2.log
          52 kB
          mutu
        6. systemAsync3.log
          53 kB
          mutu

        Activity

          People

            Unassigned Unassigned
            gendong1 mutu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: