Mark Payne created NIFI-14663:
---------------------------------

             Summary: Threading bug can allow Processor to report that it is 
stopped before it truly is
                 Key: NIFI-14663
                 URL: https://issues.apache.org/jira/browse/NIFI-14663
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
            Reporter: Mark Payne
            Assignee: Mark Payne
         Attachments: image-2025-06-14-11-16-22-089.png

In order to determine if a Processor is fully stopped, we must do 2 things: We 
must check that the state is STOPPED and we must also check that there are no 
active threads.

However, when ProcessorNode.stop() is called, it transitions the state from 
RUNNING to STOPPING (STOPPING is an "internal-only" state that is never exposed 
outside of the ProcessorNode class) and then immediately increment the Active 
Thread Count (unless there are no lifecycle methods to call).

This can result in a Processor being stopped, which transitions its internal 
state to STOPPING and then ProcessorNode.isRunning() will return false. 
Immediately afterward, the Active Thread count can be incremented to 1 in order 
to call @OnUnscheduled methods, and ProcessorNode.isRunning() will return true 
- even though it hasn't been restated.

This has been observed in a failure of 
FlowSynchronizationTestIT.testAddControllerServiceReferencingExistingService()



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to