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

Ferenc Gerlits updated MINIFICPP-2375:
--------------------------------------
    Description: 
When running ExecuteScript with
{noformat}
    Properties:
      Script Engine: lua
      Script Body: print("hello world!") {noformat}
onTrigger throws an exception, and the flow file gets penalized, although the 
script gets called: "hello world!" is printed to the console.  The log file has
{noformat}
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::Processor] 
[warning] Caught "attempt to call a nil value
stack traceback:" 
(N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE) during 
Processor::onTrigger of processor: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5 
(Execute script) (2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5)
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::ProcessSession] 
[warning] ProcessSession rollback for Execute script executed
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::SchedulingAgent] 
[warning] Caught Exception during SchedulingAgent::onTrigger of processor 
Execute script (uuid: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5), type: 
N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE, what: attempt to 
call a nil value
stack traceback: {noformat}
This is because the LuaScriptEngine requires the {{onTrigger}} function.  The 
PythonScriptEngine also supports the use case of a simple script without an 
{{onTrigger}} function; in this case, no flow files can be processed or 
produced, but the processor can still be useful if Timer Driven or Cron Driven. 
 I think the LuaScriptEngine should support this simple use case, as well.

  was:
When running ExecuteScript with
{noformat}
    Properties:
      Script Engine: lua
      Script Body: print("hello world!") {noformat}
onTrigger throws an exception, and the flow file gets penalized, although the 
script gets called: "hello world!" is printed to the console.  The log file has
{noformat}
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::Processor] 
[warning] Caught "attempt to call a nil value
stack traceback:" 
(N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE) during 
Processor::onTrigger of processor: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5 
(Execute script) (2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5)
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::ProcessSession] 
[warning] ProcessSession rollback for Execute script executed
[2024-05-15 15:11:29.108] [org::apache::nifi::minifi::SchedulingAgent] 
[warning] Caught Exception during SchedulingAgent::onTrigger of processor 
Execute script (uuid: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5), type: 
N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE, what: attempt to 
call a nil value
stack traceback: {noformat}


> ExecuteScript with lua throws if there is no onTrigger function
> ---------------------------------------------------------------
>
>                 Key: MINIFICPP-2375
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-2375
>             Project: Apache NiFi MiNiFi C++
>          Issue Type: Improvement
>            Reporter: Ferenc Gerlits
>            Priority: Minor
>
> When running ExecuteScript with
> {noformat}
>     Properties:
>       Script Engine: lua
>       Script Body: print("hello world!") {noformat}
> onTrigger throws an exception, and the flow file gets penalized, although the 
> script gets called: "hello world!" is printed to the console.  The log file 
> has
> {noformat}
> [2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::Processor] 
> [warning] Caught "attempt to call a nil value
> stack traceback:" 
> (N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE) during 
> Processor::onTrigger of processor: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5 
> (Execute script) (2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5)
> [2024-05-15 15:11:29.108] [org::apache::nifi::minifi::core::ProcessSession] 
> [warning] ProcessSession rollback for Execute script executed
> [2024-05-15 15:11:29.108] [org::apache::nifi::minifi::SchedulingAgent] 
> [warning] Caught Exception during SchedulingAgent::onTrigger of processor 
> Execute script (uuid: 2cc9c0d6-6ea2-473e-a30d-5debb0b3b2c5), type: 
> N3org6apache4nifi6minifi10extensions3lua18LuaScriptExceptionE, what: attempt 
> to call a nil value
> stack traceback: {noformat}
> This is because the LuaScriptEngine requires the {{onTrigger}} function.  The 
> PythonScriptEngine also supports the use case of a simple script without an 
> {{onTrigger}} function; in this case, no flow files can be processed or 
> produced, but the processor can still be useful if Timer Driven or Cron 
> Driven.  I think the LuaScriptEngine should support this simple use case, as 
> well.



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

Reply via email to