Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-2950

ArrayIndexOutOfBoundsException in FieldsGrouper.chooseTasks function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • None

    Description

      TupleUtils.chooseTaskIndex:

      public static <T> int chooseTaskIndex(List<T> keys, int numTasks) {
          return Math.abs(listHashCode(keys)) % numTasks;
      }
      

       
      listHashCode(keys) might return Integer.MIN_VALUE (-2147483648). Math.abs(-2147483648) equals to -2147483648.

      In this case, chooseTaskIndex might return negative numbers and it will cause ArrayIndexOutOfBoundsException in FieldsGrouper.chooseTasks

       @Override
              public List<Integer> chooseTasks(int taskId, List<Object> values) {
                  int targetTaskIndex = TupleUtils.chooseTaskIndex(outFields.select(groupFields, values), numTasks);
                  return targetTasks.get(targetTaskIndex);
              }
      

       

      Attachments

        Issue Links

          Activity

            People

              ethanli Ethan Li
              ethanli Ethan Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m