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

Kevin Doran updated NIFI-5950:
------------------------------
    Description: 
Originally reported on the users@nifi mailing list on this thread:
 
[https://lists.apache.org/thread.html/cf1206d65109bd35e07dfa9b7a24684a31e0580ddc2d351d2cb6eeaa@%3Cusers.nifi.apache.org%3E]
h2. Steps to reproduce
 # Create a PG. We will call this PG1 in these instructions
 # Add an input port to PG1 named "my port"
 # Start version control on PG1 to save to registry
 # Create a new PG (PG2) by importing PG1 at version 1 from Registry.
 # In PG1, delete the input port named "my port"
 # In PG1, add an input port with the same name as the port you just deleted, 
"my port"
 # Commit a new version of PG1 to registry
 # Change/update PG2 to version 2. This will trigger the failure.

h2. Analysis

During the update, we are attempting to remove an input port and and add an 
input port with the same name (but different IDs). Here is an example diff that 
makes this apparent:
{noformat}
{
  "bucketId": "898c9714-f3fa-456a-ac81-b63b7b0e7ff9",
  "componentDifferenceGroups": [
    {
      "componentId": "956f4819-77d3-3044-a6df-cf79c9be0646",
      "componentName": "my port",
      "componentType": "Input Port",
      "differences": [
        {
          "changeDescription": "Input Port was added",
          "differenceType": "COMPONENT_ADDED",
          "differenceTypeDescription": "Component Added",
          "valueB": "956f4819-77d3-3044-a6df-cf79c9be0646"
        }
      ],
      "processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
    },
    {
      "componentId": "3434b1ce-e5be-348e-897e-cb8f79fdc42a",
      "componentName": "my port",
      "componentType": "Input Port",
      "differences": [
        {
          "changeDescription": "Input Port was removed",
          "differenceType": "COMPONENT_REMOVED",
          "differenceTypeDescription": "Component Removed",
          "valueA": "3434b1ce-e5be-348e-897e-cb8f79fdc42a"
        }
      ],
      "processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
    }
  ],
  "flowId": "4f5a691c-428d-4439-9013-9a729b5f5d37",
  "versionA": 1,
  "versionB": 2
}
{noformat}

*It is likely that the update flow logic in 
[StandardProcessGroup|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java]
 is attempting to add the new input port before deleting the existing one. As 
input ports are required to have unique names, it fails with the 
exception/message we see in the stack trace.*
h3. Stack trace:
{noformat}
2019-01-10 21:18:38,032 ERROR [Version Control Update Thread-1] 
org.apache.nifi.web.api.VersionsResource Failed to update flow to new version
java.lang.IllegalStateException: The input port name or identifier is not 
available to be added.
  at 
org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:512)
  at 
org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:4142)
  at 
org.apache.nifi.groups.StandardProcessGroup.updateProcessGroup(StandardProcessGroup.java:3597)
  at 
org.apache.nifi.groups.StandardProcessGroup.updateFlow(StandardProcessGroup.java:3367)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO.updateProcessGroupFlow(StandardProcessGroupDAO.java:358)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$FastClassBySpringCGLIB$$10a99b47.invoke(<generated>)
  at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
  at 
org.apache.nifi.audit.ProcessGroupAuditor.updateProcessGroupFlowAdvice(ProcessGroupAuditor.java:282)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
  at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$EnhancerBySpringCGLIB$$9d72ce1d.updateProcessGroupFlow(<generated>)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$14.update(StandardNiFiServiceFacade.java:4380)
  at 
org.apache.nifi.web.revision.NaiveRevisionManager.updateRevision(NaiveRevisionManager.java:117)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade.updateProcessGroupContents(StandardNiFiServiceFacade.java:4376)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$$FastClassBySpringCGLIB$$358780e0.invoke(<generated>)
  at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
  at 
org.apache.nifi.web.NiFiServiceFacadeLock.proceedWithWriteLock(NiFiServiceFacadeLock.java:173)
  at 
org.apache.nifi.web.NiFiServiceFacadeLock.updateLock(NiFiServiceFacadeLock.java:66)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
  at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$$EnhancerBySpringCGLIB$$f366f297.updateProcessGroupContents(<generated>)
  at 
org.apache.nifi.web.api.VersionsResource.updateFlowVersion(VersionsResource.java:1526)
  at 
org.apache.nifi.web.api.VersionsResource.lambda$null$19(VersionsResource.java:1186)
  at 
org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
{noformat}
h2. Workaround for affected versions of NiFi:

If you are encountering this issue in your usage of NiFi, it is recommended to 
rename the input port that is causing the issue, save a new version of your 
flow, and then do an update/change version that skips ahead to the new version 
of the flow with the unique name. Basically, avoid deleting and adding an input 
port with the same name in a single revision of your flow, and if you have 
already done that, make a new revision that changes the name.
h2. Proposed fix:

Change the logic in {{StandardProcessGroup}} so that when flow diffs are being 
applied, all {{COMPONENT_REMOVED}} changes are applied before 
{{COMPONENT_ADDED}} changes.

  was:
Originally reported on the users@nifi mailing list on this thread:
 
[https://lists.apache.org/thread.html/cf1206d65109bd35e07dfa9b7a24684a31e0580ddc2d351d2cb6eeaa@%3Cusers.nifi.apache.org%3E]
h2. Steps to reproduce
 # Create a PG. We will call this PG1 in these instructions
 # Add an input port to PG1 named "my port"
 # Start version control on PG1 to save to registry
 # Create a new PG (PG2) by importing PG1 at version 1 from Registry.
 # In PG1, delete the input port named "my port"
 # In PG1, add an input port with the same name as the port you just deleted, 
"my port"
 # Commit a new version of PG1 to registry
 # Change/update PG2 to version 2. This will trigger the failure.

h2. Analysis

During the update, we are attempting to remove an input port and and add an 
input port with the same name (but different IDs). Here is an example diff that 
makes this apparent:
{noformat}
{
"bucketId": "898c9714-f3fa-456a-ac81-b63b7b0e7ff9",
"componentDifferenceGroups": [
{
"componentId": "956f4819-77d3-3044-a6df-cf79c9be0646",
"componentName": "my port",
"componentType": "Input Port",
"differences": [
{
"changeDescription": "Input Port was added",
"differenceType": "COMPONENT_ADDED",
"differenceTypeDescription": "Component Added",
"valueB": "956f4819-77d3-3044-a6df-cf79c9be0646"
}
],
"processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
},
{
"componentId": "3434b1ce-e5be-348e-897e-cb8f79fdc42a",
"componentName": "my port",
"componentType": "Input Port",
"differences": [
{
"changeDescription": "Input Port was removed",
"differenceType": "COMPONENT_REMOVED",
"differenceTypeDescription": "Component Removed",
"valueA": "3434b1ce-e5be-348e-897e-cb8f79fdc42a"
}
],
"processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
}
],
"flowId": "4f5a691c-428d-4439-9013-9a729b5f5d37",
"versionA": 1,
"versionB": 2
}
{noformat}
*It is likely that the update flow logic in 
[StandardProcessGroup|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java]
 is attempting to add the new input port before deleting the existing one. As 
input ports are required to have unique names, it fails with the 
exception/message we see in the stack trace.*
h3. Stack trace:
{noformat}
2019-01-10 21:18:38,032 ERROR [Version Control Update Thread-1] 
org.apache.nifi.web.api.VersionsResource Failed to update flow to new version
java.lang.IllegalStateException: The input port name or identifier is not 
available to be added.
  at 
org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:512)
  at 
org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:4142)
  at 
org.apache.nifi.groups.StandardProcessGroup.updateProcessGroup(StandardProcessGroup.java:3597)
  at 
org.apache.nifi.groups.StandardProcessGroup.updateFlow(StandardProcessGroup.java:3367)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO.updateProcessGroupFlow(StandardProcessGroupDAO.java:358)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$FastClassBySpringCGLIB$$10a99b47.invoke(<generated>)
  at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
  at 
org.apache.nifi.audit.ProcessGroupAuditor.updateProcessGroupFlowAdvice(ProcessGroupAuditor.java:282)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
  at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
  at 
org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$EnhancerBySpringCGLIB$$9d72ce1d.updateProcessGroupFlow(<generated>)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$14.update(StandardNiFiServiceFacade.java:4380)
  at 
org.apache.nifi.web.revision.NaiveRevisionManager.updateRevision(NaiveRevisionManager.java:117)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade.updateProcessGroupContents(StandardNiFiServiceFacade.java:4376)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$$FastClassBySpringCGLIB$$358780e0.invoke(<generated>)
  at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
  at 
org.apache.nifi.web.NiFiServiceFacadeLock.proceedWithWriteLock(NiFiServiceFacadeLock.java:173)
  at 
org.apache.nifi.web.NiFiServiceFacadeLock.updateLock(NiFiServiceFacadeLock.java:66)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
  at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
  at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
  at 
org.apache.nifi.web.StandardNiFiServiceFacade$$EnhancerBySpringCGLIB$$f366f297.updateProcessGroupContents(<generated>)
  at 
org.apache.nifi.web.api.VersionsResource.updateFlowVersion(VersionsResource.java:1526)
  at 
org.apache.nifi.web.api.VersionsResource.lambda$null$19(VersionsResource.java:1186)
  at 
org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
{noformat}
h2. Workaround for affected versions of NiFi:

If you are encountering this issue in your usage of NiFi, it is recommended to 
rename the input port that is causing the issue, save a new version of your 
flow, and then do an update/change version that skips ahead to the new version 
of the flow with the unique name. Basically, avoid deleting and adding an input 
port with the same name in a single revision of your flow, and if you have 
already done that, make a new revision that changes the name.
h2. Proposed fix:

Change the logic in {{StandardProcessGroup}} so that when flow diffs are being 
applied, all {{COMPONENT_REMOVED}} changes are applied before 
{{COMPONENT_ADDED}} changes.


> Error updating flow version if input port has been removed and re-added with 
> the same name.
> -------------------------------------------------------------------------------------------
>
>                 Key: NIFI-5950
>                 URL: https://issues.apache.org/jira/browse/NIFI-5950
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Flow Versioning
>    Affects Versions: 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.7.1
>            Reporter: Kevin Doran
>            Priority: Major
>             Fix For: 1.9.0
>
>
> Originally reported on the users@nifi mailing list on this thread:
>  
> [https://lists.apache.org/thread.html/cf1206d65109bd35e07dfa9b7a24684a31e0580ddc2d351d2cb6eeaa@%3Cusers.nifi.apache.org%3E]
> h2. Steps to reproduce
>  # Create a PG. We will call this PG1 in these instructions
>  # Add an input port to PG1 named "my port"
>  # Start version control on PG1 to save to registry
>  # Create a new PG (PG2) by importing PG1 at version 1 from Registry.
>  # In PG1, delete the input port named "my port"
>  # In PG1, add an input port with the same name as the port you just deleted, 
> "my port"
>  # Commit a new version of PG1 to registry
>  # Change/update PG2 to version 2. This will trigger the failure.
> h2. Analysis
> During the update, we are attempting to remove an input port and and add an 
> input port with the same name (but different IDs). Here is an example diff 
> that makes this apparent:
> {noformat}
> {
>   "bucketId": "898c9714-f3fa-456a-ac81-b63b7b0e7ff9",
>   "componentDifferenceGroups": [
>     {
>       "componentId": "956f4819-77d3-3044-a6df-cf79c9be0646",
>       "componentName": "my port",
>       "componentType": "Input Port",
>       "differences": [
>         {
>           "changeDescription": "Input Port was added",
>           "differenceType": "COMPONENT_ADDED",
>           "differenceTypeDescription": "Component Added",
>           "valueB": "956f4819-77d3-3044-a6df-cf79c9be0646"
>         }
>       ],
>       "processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
>     },
>     {
>       "componentId": "3434b1ce-e5be-348e-897e-cb8f79fdc42a",
>       "componentName": "my port",
>       "componentType": "Input Port",
>       "differences": [
>         {
>           "changeDescription": "Input Port was removed",
>           "differenceType": "COMPONENT_REMOVED",
>           "differenceTypeDescription": "Component Removed",
>           "valueA": "3434b1ce-e5be-348e-897e-cb8f79fdc42a"
>         }
>       ],
>       "processGroupId": "6cca3284-5caf-3555-9813-48f2dd913782"
>     }
>   ],
>   "flowId": "4f5a691c-428d-4439-9013-9a729b5f5d37",
>   "versionA": 1,
>   "versionB": 2
> }
> {noformat}
> *It is likely that the update flow logic in 
> [StandardProcessGroup|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java]
>  is attempting to add the new input port before deleting the existing one. As 
> input ports are required to have unique names, it fails with the 
> exception/message we see in the stack trace.*
> h3. Stack trace:
> {noformat}
> 2019-01-10 21:18:38,032 ERROR [Version Control Update Thread-1] 
> org.apache.nifi.web.api.VersionsResource Failed to update flow to new version
> java.lang.IllegalStateException: The input port name or identifier is not 
> available to be added.
>   at 
> org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:512)
>   at 
> org.apache.nifi.groups.StandardProcessGroup.addInputPort(StandardProcessGroup.java:4142)
>   at 
> org.apache.nifi.groups.StandardProcessGroup.updateProcessGroup(StandardProcessGroup.java:3597)
>   at 
> org.apache.nifi.groups.StandardProcessGroup.updateFlow(StandardProcessGroup.java:3367)
>   at 
> org.apache.nifi.web.dao.impl.StandardProcessGroupDAO.updateProcessGroupFlow(StandardProcessGroupDAO.java:358)
>   at 
> org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$FastClassBySpringCGLIB$$10a99b47.invoke(<generated>)
>   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
>   at 
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>   at 
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
>   at 
> org.apache.nifi.audit.ProcessGroupAuditor.updateProcessGroupFlowAdvice(ProcessGroupAuditor.java:282)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
>   at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
>   at 
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>   at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>   at 
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
>   at 
> org.apache.nifi.web.dao.impl.StandardProcessGroupDAO$$EnhancerBySpringCGLIB$$9d72ce1d.updateProcessGroupFlow(<generated>)
>   at 
> org.apache.nifi.web.StandardNiFiServiceFacade$14.update(StandardNiFiServiceFacade.java:4380)
>   at 
> org.apache.nifi.web.revision.NaiveRevisionManager.updateRevision(NaiveRevisionManager.java:117)
>   at 
> org.apache.nifi.web.StandardNiFiServiceFacade.updateProcessGroupContents(StandardNiFiServiceFacade.java:4376)
>   at 
> org.apache.nifi.web.StandardNiFiServiceFacade$$FastClassBySpringCGLIB$$358780e0.invoke(<generated>)
>   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
>   at 
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>   at 
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
>   at 
> org.apache.nifi.web.NiFiServiceFacadeLock.proceedWithWriteLock(NiFiServiceFacadeLock.java:173)
>   at 
> org.apache.nifi.web.NiFiServiceFacadeLock.updateLock(NiFiServiceFacadeLock.java:66)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
>   at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
>   at 
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>   at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
>   at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>   at 
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
>   at 
> org.apache.nifi.web.StandardNiFiServiceFacade$$EnhancerBySpringCGLIB$$f366f297.updateProcessGroupContents(<generated>)
>   at 
> org.apache.nifi.web.api.VersionsResource.updateFlowVersion(VersionsResource.java:1526)
>   at 
> org.apache.nifi.web.api.VersionsResource.lambda$null$19(VersionsResource.java:1186)
>   at 
> org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117)
>   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>   at java.lang.Thread.run(Thread.java:748)
> {noformat}
> h2. Workaround for affected versions of NiFi:
> If you are encountering this issue in your usage of NiFi, it is recommended 
> to rename the input port that is causing the issue, save a new version of 
> your flow, and then do an update/change version that skips ahead to the new 
> version of the flow with the unique name. Basically, avoid deleting and 
> adding an input port with the same name in a single revision of your flow, 
> and if you have already done that, make a new revision that changes the name.
> h2. Proposed fix:
> Change the logic in {{StandardProcessGroup}} so that when flow diffs are 
> being applied, all {{COMPONENT_REMOVED}} changes are applied before 
> {{COMPONENT_ADDED}} changes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to