ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1480

ClientCnxn(1161) can't get the current zk server add, so that - Session 0x for server null, unexpected error

    Details

    • Tags:
      client,zookeeper addr,server

      Description

        When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
        We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
        I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

        Here:
      /**

      • Returns the address to which the socket is connected.
      • @return ip address of the remote side of the connection or null if not
      • connected
        */
        @Override
        SocketAddress getRemoteSocketAddress() {
        // a lot could go wrong here, so rather than put in a bunch of code
        // to check for nulls all down the chain let's do it the simple
        // yet bulletproof way
        .....

        Activity

        Leader Ni created issue -
        Leader Ni made changes -
        Field Original Value New Value
        Labels client getCurrentZooKeeperAddr
        Leader Ni made changes -
        Description    When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
           We found that, sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
           I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

           When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
           We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
           I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr.path [ 12531054 ]
        Leader Ni made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr.path [ 12531054 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr.patch [ 12531055 ]
        Patrick Hunt made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Fix Version/s 3.4.4 [ 12319841 ]
        Fix Version/s 3.5.0 [ 12316644 ]
        Fix Version/s 3.3.6 [ 12320172 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr_for_3.3.3.patch [ 12531205 ]
        Attachment getCurrentZooKeeperAddr_for_branch3.4.patch [ 12531206 ]
        Attachment getCurrentZooKeeperAddr_for_trunk.patch [ 12531207 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr.patch [ 12531055 ]
        Leader Ni made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Leader Ni made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Leader Ni made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr_for_3.3.3.patch [ 12531205 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr_for_trunk.patch [ 12531207 ]
        Leader Ni made changes -
        Attachment getCurrentZooKeeperAddr_for_3.4.3.patch [ 12552006 ]
        Leader Ni made changes -
        Status Reopened [ 4 ] Patch Available [ 10002 ]
        Affects Version/s 3.4.3 [ 12319288 ]
        Affects Version/s 3.3.3 [ 12315482 ]
        Fix Version/s 3.4.4 [ 12319841 ]
        Leader Ni made changes -
        Description    When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
           We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
           I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

          When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
          We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
          I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

          Here:
        /**
             * Returns the address to which the socket is connected.
             *
             * @return ip address of the remote side of the connection or null if not
             * connected
             */
            @Override
            SocketAddress getRemoteSocketAddress() {
                // a lot could go wrong here, so rather than put in a bunch of code
                // to check for nulls all down the chain let's do it the simple
                // yet bulletproof way
                try {
                    return ((SocketChannel) sockKey.channel()).socket()
                            .getRemoteSocketAddress();
                } catch (NullPointerException e) {
                    return null;
                }
            }
        Leader Ni made changes -
        Description   When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
          We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
          I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

          Here:
        /**
             * Returns the address to which the socket is connected.
             *
             * @return ip address of the remote side of the connection or null if not
             * connected
             */
            @Override
            SocketAddress getRemoteSocketAddress() {
                // a lot could go wrong here, so rather than put in a bunch of code
                // to check for nulls all down the chain let's do it the simple
                // yet bulletproof way
                try {
                    return ((SocketChannel) sockKey.channel()).socket()
                            .getRemoteSocketAddress();
                } catch (NullPointerException e) {
                    return null;
                }
            }
          When zookeeper occur an unexpected error( Not SessionExpiredException, SessionTimeoutException and EndOfStreamException), ClientCnxn(1161) will log such as the formart "Session 0x for server null, unexpected error, closing socket connection and attempting reconnect ". The log at line 1161 in zookeeper-3.3.3
          We found that, zookeeper use "((SocketChannel)sockKey.channel()).socket().getRemoteSocketAddress()" to get zookeeper addr. But,Sometimes, it logs "Session 0x for server null", you know, if log null, developer can't determine the current zookeeper addr that client is connected or connecting.
          I add a method in Class SendThread:InetSocketAddress org.apache.zookeeper.ClientCnxn.SendThread.getCurrentZooKeeperAddr().

          Here:
        /**
        * Returns the address to which the socket is connected.
        *
        * @return ip address of the remote side of the connection or null if not
        * connected
        */
        @Override
        SocketAddress getRemoteSocketAddress() {
           // a lot could go wrong here, so rather than put in a bunch of code
           // to check for nulls all down the chain let's do it the simple
           // yet bulletproof way
        .....
        Patrick Hunt made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Patrick Hunt made changes -
        Fix Version/s 3.5.1 [ 12326786 ]
        Fix Version/s 3.5.0 [ 12316644 ]
        Michi Mutsuzaki made changes -
        Fix Version/s 3.5.2 [ 12331981 ]
        Fix Version/s 3.6.0 [ 12326518 ]
        Fix Version/s 3.5.1 [ 12326786 ]

          People

          • Assignee:
            Leader Ni
            Reporter:
            Leader Ni
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:

              Development