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

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

Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2634#discussion_r181792251
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java
 ---
    @@ -103,8 +104,24 @@ private boolean isYielded() {
             return connectable.getYieldExpiration() > 
System.currentTimeMillis();
         }
     
    +    /**
    +     * Make sure processor has work to do. This means that it meets one of 
these criteria:
    +     * <ol>
    +     * <li>It is annotated with @TriggerWhenEmpty</li>
    +     * <li>It has no incoming connections</li>
    +     * <li>All incoming connections are self-loops</li>
    +     * <li>It has data in an incoming Connection
    +     *     AND It is not a Funnel without outgoing connections
    +     * </li>
    +     * </ol>
    +     * @return true if there is work to do, otherwise false
    +     */
         private boolean isWorkToDo() {
    -        return connectable.isTriggerWhenEmpty() || 
!connectable.hasIncomingConnection() || !hasNonLoopConnection || 
Connectables.flowFilesQueued(connectable);
    +        return connectable.isTriggerWhenEmpty()
    +                || !connectable.hasIncomingConnection()
    +                || !hasNonLoopConnection
    +                || (Connectables.flowFilesQueued(connectable)
    --- End diff --
    
    @ijokarumawak unfortunately, this doesn't appear to fully address the 
issue. It appears that the clause above this one, "!hasNonLoopConnection" is 
evaluating to true in my case (simple GenerateFlowFile -> Funnel).
    
    I think I would actually recommend just adding a block of code to the 
beginning of this method like:
    ```
    if (connectable.getConnectableType() == ConnectableType.FUNNEL) {
      return !connectable.getConnections().isEmpty() && 
connectable.hasIncomingConnection() && hasNonLoopConnection;
    } else {
      // do what we already do
    }
    ```
    
    I recommend this because Funnels are a special case, since they are really 
intended to be 'notional' and never stopped or started. They are always 
running. And for Funnels, in particular, it only really makes sense to run if 
there is in fact an incoming connection (rather than processors where we want 
to run even if there isn't an incoming connection), AND If there is at least 
one outgoing connection (funnels don't support auto-terminating relationships).


> Funnels with no outgoing relationship error
> -------------------------------------------
>
>                 Key: NIFI-5075
>                 URL: https://issues.apache.org/jira/browse/NIFI-5075
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.6.0
>            Reporter: Peter Wicks
>            Assignee: Koji Kawamura
>            Priority: Major
>
> If a Funnel has no outgoing relationships it will throw an exception when it 
> tries to send FlowFile's to that non-existent relationship.
> Replicate by creating a GenerateFlowFile processor to a Funnel, start the 
> GenerateFlowFile processor and check your log file.
>  
> 2018-04-11 23:53:28,066 ERROR [Timer-Driven Process Thread-31] 
> o.apache.nifi.controller.StandardFunnel 
> StandardFunnel[id=b868231c-0162-1000-571c-ae3e7d15d848] 
> StandardFunnel[id=b868231c-0162-1000-571c-ae3e7d15d848] failed to process 
> session due to java.lang.RuntimeException: 
> java.lang.IllegalArgumentException: Relationship '' is not known; Processor 
> Administratively Yielded for 1 sec: java.lang.RuntimeException: 
> java.lang.IllegalArgumentException: Relationship '' is not known
> java.lang.RuntimeException: java.lang.IllegalArgumentException: Relationship 
> '' is not known
>         at 
> org.apache.nifi.controller.StandardFunnel.onTrigger(StandardFunnel.java:365)
>         at 
> org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:175)
>         at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
>         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: java.lang.IllegalArgumentException: Relationship '' is not known
>         at 
> org.apache.nifi.controller.repository.StandardProcessSession.transfer(StandardProcessSession.java:1935)
>         at 
> org.apache.nifi.controller.StandardFunnel.onTrigger(StandardFunnel.java:379)
>         at 
> org.apache.nifi.controller.StandardFunnel.onTrigger(StandardFunnel.java:358)
>         ... 9 common frames omitted



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

Reply via email to