Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-8723

Set reasonable connection timeout for CuratorFramework ZooKeeper clients in Hive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.14.0
    • 0.14.0
    • None
    • None

    Description

      Currently we use -1, due to which "any" elapsed time is always greater than any timeout value resulting in an unnecessary connection loss exception. Relevant code from curator framework:

       private synchronized void checkTimeouts() throws Exception
          {
              int minTimeout = Math.min(sessionTimeoutMs, connectionTimeoutMs);
              long elapsed = System.currentTimeMillis() - connectionStartMs;
              if ( elapsed >= minTimeout )
              {
                  if ( zooKeeper.hasNewConnectionString() )
                  {
                      handleNewConnectionString();
                  }
                  else
                  {
                      int maxTimeout = Math.max(sessionTimeoutMs, connectionTimeoutMs);
                      if ( elapsed > maxTimeout )
                      {
                          if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                          {
                              log.warn(String.format("Connection attempt unsuccessful after %d (greater than max timeout of %d). Resetting connection and trying again with a new connection.", elapsed, maxTimeout));
                          }
                          reset();
                      }
                      else
                      {
                          KeeperException.ConnectionLossException connectionLossException = new CuratorConnectionLossException();
                          if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                          {
                              log.error(String.format("Connection timed out for connection string (%s) and timeout (%d) / elapsed (%d)", zooKeeper.getConnectionString(), connectionTimeoutMs, elapsed), connectionLossException);
                          }
                          tracer.get().addCount("connections-timed-out", 1);
                          throw connectionLossException;
                      }
                  }
              }
          }
      
      

      Attachments

        1. HIVE-8723.1.patch
          5 kB
          Vaibhav Gumashta
        2. HIVE-8723.2.patch
          10 kB
          Vaibhav Gumashta

        Issue Links

          Activity

            People

              vgumashta Vaibhav Gumashta
              vgumashta Vaibhav Gumashta
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: