Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5704

Split inside Split - Parallel processing issue - Thread is getting wrong Exchange when leaving inner split

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.9.3
    • 2.9.5, 2.10.3, 2.11.0
    • camel-core
    • None
    • Unknown

    Description

      A small JUnit recreation case is attached.
      When using embedded split inside a split with parallel processing, threads are getting a wrong exchange (or wrong exchange copy) just after leaving the inner split and returning to the parent split.

      In the test case, we split a file by comma in a parent split (Block split), then by line separator in inner split (Line Split).
      We expect 2 files in output, each of them containing the respective Blocks.

      However, once inner split is complete, each thread is supposed to add a 11th line in the result.txt file saying split is complete.
      Bug is that one of the thread ends up with parent split Exchange (copy?) from the other thread, and appends wrong information into the wrong file.

      Expected:
      ---------
      (result0.txt)
      Block1 Line 1:Status=OK
      Block1 Line 2:Status=OK
      Block1 Line 0:Status=OK
      Block1 Line 4:Status=OK
      Block1 Line 3:Status=OK
      Block1 Line 8:Status=OK
      Block1 Line 5:Status=OK
      Block1 Line 6:Status=OK
      Block1 Line 7:Status=OK
      Block1 Line 9:Status=OK
      0 complete

      (result1.txt)
      Block2 Line 0:Status=OK
      Block2 Line 3:Status=OK
      Block2 Line 1:Status=OK
      Block2 Line 2:Status=OK
      Block2 Line 6:Status=OK
      Block2 Line 4:Status=OK
      Block2 Line 7:Status=OK
      Block2 Line 9:Status=OK
      Block2 Line 5:Status=OK
      Block2 Line 8:Status=OK
      1 complete

      Actual:
      -------
      (result0.txt)
      Block1 Line 1:Status=OK
      Block1 Line 2:Status=OK
      Block1 Line 0:Status=OK
      Block1 Line 4:Status=OK
      Block1 Line 3:Status=OK
      Block1 Line 8:Status=OK
      Block1 Line 5:Status=OK
      Block1 Line 6:Status=OK
      Block1 Line 7:Status=OK
      Block1 Line 9:Status=OK
      0 complete0 complete

      (result1.txt)
      Block2 Line 0:Status=OK
      Block2 Line 3:Status=OK
      Block2 Line 1:Status=OK
      Block2 Line 2:Status=OK
      Block2 Line 6:Status=OK
      Block2 Line 4:Status=OK
      Block2 Line 7:Status=OK
      Block2 Line 9:Status=OK
      Block2 Line 5:Status=OK
      Block2 Line 8:Status=OK

      This issue exist in 2.8.x, and probably in 2.10.x as well.
      This is a Splitter/MulticastProcessor or Pipeline issue but not quite familiar with the code, I am having hard time tracking it.

      Attachments

        1. FileSplitInSplitTest.java
          3 kB
          Gilles Huron

        Issue Links

          Activity

            People

              njiang Willem Jiang
              gill3s Gilles Huron
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: