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

ASF GitHub Bot commented on NIFI-5437:
--------------------------------------

GitHub user pvillard31 opened a pull request:

    https://github.com/apache/nifi/pull/2903

    NIFI-5437 - Yield in ExecuteScript when catching ScriptException

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pvillard31/nifi NIFI-5437

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2903.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2903
    
----
commit 94d2751801f9d4e6f118c89da357047e885fb850
Author: Pierre Villard <pierre.villard.fr@...>
Date:   2018-07-17T16:29:32Z

    NIFI-5437 - Yield in ExecuteScript when catching ScriptException

----


> Yield in ExecuteScript when catching ScriptException
> ----------------------------------------------------
>
>                 Key: NIFI-5437
>                 URL: https://issues.apache.org/jira/browse/NIFI-5437
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Pierre Villard
>            Assignee: Pierre Villard
>            Priority: Major
>
> In case of ScriptException in ExecuteScript, a flow file can be processed 
> again and again which can lead to resource exhaustion and node instability. 
> Proposition: yield the processor when an exception is caught before throwing 
> a Process Exception.
> Example of exception:
> {code:java}
> 2018-07-17 16:15:23,392 ERROR [Timer-Driven Process Thread-9] 
> o.a.nifi.processors.script.ExecuteScript 
> ExecuteScript[id=9d776ec4-e9d7-1bca-ffff-ffffbe6c5019] Failed to process 
> session due to org.apache.nifi.processor.exception.ProcessException: 
> javax.script.ScriptException: TypeError: unsupported operand type(s) for +: 
> 'int' and 'str' in <script> at line number 82: {}
> org.apache.nifi.processor.exception.ProcessException: 
> javax.script.ScriptException: TypeError: unsupported operand type(s) for +: 
> 'int' and 'str' in <script> at line number 82
>         at 
> org.apache.nifi.processors.script.ExecuteScript.onTrigger(ExecuteScript.java:230)
>         at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1118)
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
>         at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:748)
> Caused by: javax.script.ScriptException: TypeError: unsupported operand 
> type(s) for +: 'int' and 'str' in <script> at line number 82
>         at 
> org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
>         at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
>         at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
>         at 
> javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
>         at 
> org.apache.nifi.script.impl.JythonScriptEngineConfigurator.eval(JythonScriptEngineConfigurator.java:59)
>         at 
> org.apache.nifi.processors.script.ExecuteScript.onTrigger(ExecuteScript.java:220)
>         ... 11 common frames omitted
> Caused by: org.python.core.PyException: null
>         at org.python.core.PyException.doRaise(PyException.java:198)
>         at org.python.core.Py.makeException(Py.java:1337)
>         at org.python.core.Py.makeException(Py.java:1341)
>         at org.python.core.Py.makeException(Py.java:1345)
>         at org.python.core.Py.makeException(Py.java:1349)
>         at org.python.pycode._pyx32499415.process$4(<script>:76)
>         at org.python.pycode._pyx32499415.call_function(<script>)
>         at org.python.core.PyTableCode.call(PyTableCode.java:167)
>         at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
>         at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
>         at org.python.core.PyFunction.__call__(PyFunction.java:482)
>         at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
>         at org.python.core.PyMethod.__call__(PyMethod.java:228)
>         at org.python.core.PyMethod.__call__(PyMethod.java:218)
>         at org.python.core.PyMethod.__call__(PyMethod.java:213)
>         at org.python.core.PyObject._jcallexc(PyObject.java:3626)
>         at 
> org.python.proxies.__builtin__$TransformCallback$16249707.process(Unknown 
> Source)
>         at 
> org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2785)
>         at sun.reflect.GeneratedMethodAccessor649.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at 
> org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
>         at 
> org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
>         at org.python.core.PyObject.__call__(PyObject.java:496)
>         at org.python.core.PyObject.__call__(PyObject.java:500)
>         at org.python.core.PyMethod.__call__(PyMethod.java:156)
>         at org.python.pycode._pyx32499415.f$0(<script>:81)
>         at org.python.pycode._pyx32499415.call_function(<script>)
>         at org.python.core.PyTableCode.call(PyTableCode.java:167)
>         at org.python.core.PyCode.call(PyCode.java:18)
>         at org.python.core.Py.runCode(Py.java:1386)
>         at org.python.core.__builtin__.eval(__builtin__.java:497)
>         at org.python.core.__builtin__.eval(__builtin__.java:501)
>         at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
>         at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
>         ... 15 common frames omitted{code}



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

Reply via email to