Uploaded image for project: 'Apache NiFi MiNiFi C++'
  1. Apache NiFi MiNiFi C++
  2. MINIFICPP-1610

Fix PublishKafka::notifyStop message interruption, reduce PublishKafkaOnScheduleTests runtime

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.11.0
    • None

    Description

      With MINIFICPP-1351, I introduced a connection lock before the message lock to avoid a race condition on closing the connection. It went before the message lock, because when both are taken, connection lock has to come first to avoid a deadlock.

      This caused notifyStop to wait until the messages in flight timed out and onTrigger stopped before being able to take the connection lock, then the message lock, then interrupt the messages, thus defeating the interruption.

      This issue is about fixing the situation by first taking the message lock without the connection lock, interrupting the messages, then releasing the lock and taking the connection lock (after onTrigger terminated early, thanks to the interruptions) and terminating the connection.

       

      Aside from that, I made an effort to reduce the runtime of PublishKafkaOnScheduleTests when no local kafka nodes are running. It tries to connect to one and waits for timeout, but the test doesn't need an actual running broker, this is just a side effect. Reduced timeouts, the runtime went from ~30sec to ~1.5sec.

      Attachments

        Activity

          People

            szaszm Marton Szasz
            szaszm Marton Szasz
            Votes:
            0 Vote for this issue
            Watchers:
            1 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 - 20m
                20m