Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-12615 Router-based HDFS federation phase 2
  3. HDFS-13637

RBF: Router fails when threadIndex (in ConnectionPool) wraps around Integer.MIN_VALUE

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Reviewed

    Description

          int threadIndex = this.clientIndex.getAndIncrement();
          for (int i=0; i<size; i++) {
            int index = (threadIndex + i) % size;
            conn = tmpConnections.get(index);
            if (conn != null && conn.isUsable()) {
              return conn;
            }
          }
      
      

      The above code in ConnectionPool.java getConnection method throws java.lang.ArrayIndexOutOfBoundsException when clientIndex wraps to Integer.MIN_VALUE and makes router reject all requests. threadIndex should be reset to 0.

          if (threadIndex < 0) {
              // Wrap around 0 to keep array lookup index positive
              this.clientIndex.set(0);
              threadIndex = this.clientIndex.getAndIncrement();
          }
      

       

       

      Attachments

        1. HDFS-13637.0.patch
          1.0 kB
          CR Hota
        2. HDFS-13637.1.patch
          4 kB
          CR Hota
        3. HDFS-13637.2.patch
          3 kB
          CR Hota
        4. HDFS-13637.3.patch
          3 kB
          CR Hota

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            crh CR Hota
            crh CR Hota
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment