Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-4235

Fix the closing order in Sender.initiateClose().

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0.0
    • Fix Version/s: 0.10.1.0
    • Component/s: None
    • Labels:
      None

      Description

      In the initiate close, we need to call RecordAccumulator.close() before set the running to false. Otherwise we may miss a callback if the following sequence happens:

      1. Thread 1 call Sender.forceClose(), Sender.forceClosed is set to true, Sender.running is set to false.
      2. Sender thread saw running == false, exited the while loop
      3. Sender thread saw the forceClose == true and aborted all the existing incomplete batches
      4. Thread 2 append a message into the accumulator.
      5. Thread 1 closes the accumulator
      6. Sender thread exits without firing callback for the message in step (4)

      To fix this, we need close the record accumulator before set the running flag to false in the sender thread.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                becket_qin Jiangjie Qin
                Reporter:
                becket_qin Jiangjie Qin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: