ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-519

Followerhandler should close the socket if it gets an exception on a write.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      We noticed this in our tests -

      
      java.net.SocketException: Broken pipe
              at java.net.SocketOutputStream.socketWrite0(Native Method)
              at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
              at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
              at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
              at java.io.DataOutputStream.write(DataOutputStream.java:90)
              at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
              at org.apache.jute.BinaryOutputArchive.writeBuffer(BinaryOutputArchive.java:122)
              at org.apache.zookeeper.server.DataNode.serialize(DataNode.java:126)
              at org.apache.jute.BinaryOutputArchive.writeRecord(BinaryOutputArchive.java:126)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:878)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:890)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:890)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:890)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:890)
              at org.apache.zookeeper.server.DataTree.serializeNode(DataTree.java:890)
              at org.apache.zookeeper.server.DataTree.serialize(DataTree.java:940)
              at org.apache.zookeeper.server.util.SerializeUtils.serializeSnapshot(SerializeUtils.java:102)
              at org.apache.zookeeper.server.ZooKeeperServer.serializeSnapshot(ZooKeeperServer.java:269)
              at org.apache.zookeeper.server.quorum.FollowerHandler.run(FollowerHandler.java:263)
      

      So the followerhandler got an exception while writing to the socket but the follower was still waiting on the socket for a read and got a read timeout after 60 seconds or so. To just make sure we handle this rightly, we should close the socket at the followerhandler when we get an excpetion, so that the follower immediately recognizes that its disconnected from the leader.

      1. ZOOKEEPER-519.patch
        0.9 kB
        Mahadev konar

        Activity

        Patrick Hunt made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Benjamin Reed made changes -
        Hadoop Flags [Reviewed]
        Resolution Fixed [ 1 ]
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Mahadev konar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Mahadev konar made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Mahadev konar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Mahadev konar made changes -
        Assignee Mahadev konar [ mahadev ]
        Mahadev konar made changes -
        Field Original Value New Value
        Attachment ZOOKEEPER-519.patch [ 12423855 ]
        Mahadev konar created issue -

          People

          • Assignee:
            Mahadev konar
            Reporter:
            Mahadev konar
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development