[ 
https://issues.apache.org/jira/browse/NIFI-15739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070382#comment-18070382
 ] 

ASF subversion and git services commented on NIFI-15739:
--------------------------------------------------------

Commit 1ef94fc2413bdd74549779cbf121e47a8554ff25 in nifi's branch 
refs/heads/main from dan-s1
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=1ef94fc2413 ]

NIFI-15739 Added Expression Language validation to ExecuteGroovyScript dynamic 
properties (#11059)

- Added session.get() in the onTrigger method to ensure there is a FlowFile to 
send to the failure relationship

Signed-off-by: David Handermann <[email protected]>

> ExecuteGroovyScript: FlowFile not transferred to failure when dynamic 
> property contains Expression Language syntax error
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-15739
>                 URL: https://issues.apache.org/jira/browse/NIFI-15739
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 2.5.0
>            Reporter: Xinyu Wang
>            Assignee: Daniel Stieglitz
>            Priority: Major
>         Attachments: image-2026-03-25-08-33-20-522.png
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When an ExecuteGroovyScript processor has a dynamic property whose value 
> contains an Expression Language syntax error, and the Failure Strategy is set 
> to "transfer to failure", the FlowFile in the upstream queue is not 
> transferred to the failure relationship. Instead, the FlowFile remains stuck 
> in the incoming queue, and the processor enters an infinite error loop — 
> logging the same error on every scheduling trigger.
> *Root Cause*
>   In ExecuteGroovyScript.onTrigger(), the execution order is:
>  # Evaluate dynamic properties — iterates context.getProperties() and calls 
> evaluateAttributeExpressions() on each dynamic property value
>  # Execute script — where session.get() is typically called by user code to 
> dequeue a FlowFile
>   The GroovyProcessSessionWrap maintains a toFail list that is only populated 
> when session.get() is called.
>   When a dynamic property has an EL syntax error:
>  * The exception is thrown at step 1
>  * script.run() (step 2) is never reached
>  * session.get() is never called
>  * toFail list remains empty
>  * The catch block calls session.revertReceivedTo(REL_FAILURE, t), which 
> iterates over the empty toFail list — effectively a no-op
>  * The FlowFile was never dequeued, so it stays in the incoming connection
> *Steps to Reproduce*
>  # Create a flow: GenerateFlowFile → ExecuteGroovyScript
>  # In ExecuteGroovyScript, set Failure Strategy to "Transfer to failure"
>  # Add a dynamic property (e.g. myProp) with an invalid EL expression as 
> value, e.g. *_${myparam:isempty()}_*
>  # Add a simple script body
>  # Connect the failure relationship to a downstream processor (e.g. 
> LogAttribute)
>  # Start the flow
>   {*}Expected{*}: FlowFile is transferred to the failure relationship with 
> ERROR_MESSAGE and ERROR_STACKTRACE attributes.
>   {*}Actual{*}: FlowFile remains stuck in the incoming queue. The processor 
> logs the expression language error repeatedly on every trigger. Nothing is 
> ever routed to failure.



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

Reply via email to