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

ArrayIndexOutOfBoundsException in FieldsGrouper.chooseTasks function

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: 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

              • Assignee:
                ethanli Ethan Li
                Reporter:
                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