Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-18532

IndexOutOfBoundsException in KafkaToIgniteCdcStreamer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.14
    • 2.16
    • extensions

    Description

      If the applier threads for some reason, then whiling joining the runner threads, join is waiting  for extra thread which actually does not exist.

      class org.apache.ignite.IgniteException: Index 8 out of bounds for length 8
      2	at org.apache.ignite.cdc.kafka.AbstractKafkaToIgniteCdcStreamer.run(AbstractKafkaToIgniteCdcStreamer.java:128)
      3	at org.apache.ignite.cdc.kafka.KafkaToIgniteCdcStreamer.run(KafkaToIgniteCdcStreamer.java:71)
      4	at org.apache.ignite.cdc.kafka.KafkaToIgniteCommandLineStartup.main(KafkaToIgniteCommandLineStartup.java:68)
      5Caused by: java.lang.IndexOutOfBoundsException: Index 8 out of bounds for length 8
      6	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
      7	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
      8	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
      9	at java.base/java.util.Objects.checkIndex(Objects.java:372)
      10	at java.base/java.util.ArrayList.get(ArrayList.java:459)
      11	at org.apache.ignite.cdc.kafka.AbstractKafkaToIgniteCdcStreamer.runAppliers(AbstractKafkaToIgniteCdcStreamer.java:184)
      12	at org.apache.ignite.cdc.kafka.KafkaToIgniteCdcStreamer.runx(KafkaToIgniteCdcStreamer.java:110)
      13	at org.apache.ignite.cdc.kafka.AbstractKafkaToIgniteCdcStreamer.run(AbstractKafkaToIgniteCdcStreamer.java:125)
      14	... 2 more 

      Problematic code is

      try { 
            for (int i = 0; i < threadCnt + 1; i++) 
                runners.get(i).join(); 
      }
      

      runners is as array list of threads whose size is configured to specified number of threadCount.

      runners = new ArrayList<>(streamerCfg.getThreadCount());

      In our yaml threadCount: 8

      If this is the case, then in above code, while joining threads why are we iterating for 9 threads (threadCnt + 1 = 8 +1)

      As a solution we need to iterate over runners with condition i < threadCnt and not i < threadCnt + 1

      Attachments

        Issue Links

          Activity

            People

              timonin.maksim Maksim Timonin
              KB_Open Kishor Bachhav
              Nikita Amelchev Nikita Amelchev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: