Hi everyone,
I wanted to reach out to the list to see if anyone else has run into this
issue, or if this is a known bug in Apache NiFi 2.9.0's ExecuteGroovyScript
processor. I verified on a Nifi 2.7.2 cluster, the issue does not exist.
It appears that configuring the Failure Strategy property to "transfer to
failure" completely breaks session commits—even for trivial, perfectly valid
scripts that complete successfully with no errors.
_____
🚨 The Symptoms
Whenever Failure Strategy is set to "transfer to failure", any script running
in the processor yields and throws the following dual session exceptions
back-to-back:
1. org.apache.nifi.processor.exception.FlowFileHandlingException:
StandardFlowFileRecord[...] transfer relationship not specified. This FlowFile
was not created in this session and was not transferred to any Relationship via
ProcessSession.transfer()
2. org.apache.nifi.processor.exception.FlowFileHandlingException:
StandardFlowFileRecord[...] is not known in this session
(StandardProcessSession[id=...])
_____
🛠️ How to Reproduce
You can easily reproduce this behavior with a single queue and a basic,
error-free script:
1. Add an ExecuteGroovyScript processor to your canvas.
2. Set the Failure Strategy property to transfer to failure.
3. Set the Script Body to:
def flowfile = session.get()
if (!flowfile) return
REL_SUCCESS << flowfile
4. Pass a single FlowFile into the processor.
Even though the script successfully grabs the FlowFile and routes it to
success, the processor will fail to commit, log both of the errors above,
yield, and leave the FlowFile unprocessed.
Switching the Failure Strategy back to "rollback" immediately resolves the
issue and allows the same script to run perfectly.
_____
💡 Temporary Workaround
If you are facing this, the current workaround is to keep the Failure Strategy
set to "rollback" and handle routing manually inside your Groovy script using a
try-catch block:
groovy
def flowfile = session.get()
if (!flowfile) return
try {
// Your processing logic here...
session.transfer(flowfile, REL_SUCCESS)
} catch (Exception e) {
log.error("Script failed", e)
session.transfer(flowfile, REL_FAILURE)
}
Is anyone else seeing this behavior on NiFi 2.x, or is there an active JIRA
issue tracking this?
Thanks!
Jody Des Roches
[email protected]
smime.p7s
Description: S/MIME cryptographic signature
