[ 
https://issues.apache.org/jira/browse/NIFI-15801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Payne resolved NIFI-15801.
-------------------------------
    Fix Version/s: 2.10.0
       Resolution: Fixed

> StandardVersionedComponentSynchronizer.synchronizeProcessors fails when 
> processors are running
> ----------------------------------------------------------------------------------------------
>
>                 Key: NIFI-15801
>                 URL: https://issues.apache.org/jira/browse/NIFI-15801
>             Project: Apache NiFi
>          Issue Type: Task
>          Components: Core Framework
>            Reporter: Kevin Doran
>            Assignee: Kevin Doran
>            Priority: Minor
>             Fix For: 2.10.0
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> `StandardVersionedComponentSynchronizer.synchronizeProcessors()` calls 
> `updateProcessor()` without first stopping the processor. `updateProcessor()` 
> begins with `processor.setAnnotationData(...)`, and 
> `StandardProcessorNode.setAnnotationData()` throws `IllegalStateException` if 
> the processor is running.
> This was never triggered before the introduction of Connectors, because the 
> NiFi REST API `FlowUpdateResource.updateFlow()` explicitly stops all affected 
> processors and disables affected controller services *before* calling 
> `StandardProcessGroup.updateFlow()` -> `synchronizeFlow()` -> `synchronize()` 
> -> `synchronizeProcessors()`. 
> The Connector framework's `applyUpdate` path, introduced in NIFI-15258, calls 
> `StandardProcessGroup.updateFlow()` directly without stopping processors 
> first, exposing this gap.
> The single-processor synchronization path (`synchronize(ProcessorNode, 
> VersionedProcessor, ...)`) already correctly calls `stopOrTerminate()` before 
> `updateProcessor()`. The group-level `synchronizeProcessors()` was relying on 
> the caller to have stopped processors, which was a valid assumption for the 
> REST path.
> **Steps to Reproduce:**
> 1. Start a Connector
> 2. While the connector is running, change a configuration property that 
> affects an existing processor in the flow.
> 3. Call `applyUpdate()`.
> **Expected:** The flow is updated successfully; affected processors are 
> stopped, updated, and restarted.
> **Actual:** `FlowUpdateException` wrapping `IllegalStateException: Cannot set 
> AnnotationData on CaptureChangePostgreSQL[...] while processor is running`.
> **Fix:** Stop running processors in `synchronizeProcessors()` before calling 
> `updateProcessor()`, matching the pattern used in `synchronize(ProcessorNode, 
> ...)` and `synchronizeProcessGroupSettings()`. Track which processors were 
> stopped and restart them in a `finally` block to ensure they are restarted 
> even if the update fails.



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

Reply via email to