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

Peter Gyori commented on NIFI-8207:
-----------------------------------

Fixing counter behavior in the Wait/Notify pattern turned out to require:
 * first *specifying the requirements* in cases that are not working with the 
current implementation
 * then *rewriting* the WaitNotifyProtocol *from scratch.*

Creating a correct releasableCount and reducedSignalCount calculation 
apparently requires a complete redesign of the current implementation. It may 
not be worth investing such effort into this as there are other patterns 
already implemented in NiFi for similar use-cases.

> Counters in the Wait/Notify pattern do not work as expected
> -----------------------------------------------------------
>
>                 Key: NIFI-8207
>                 URL: https://issues.apache.org/jira/browse/NIFI-8207
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Peter Gyori
>            Assignee: Peter Gyori
>            Priority: Major
>              Labels: Wait/Notify
>
> The counters in the Wait/Notify pattern do not work as expected, the way 
> counters are decremented seems to be wrong.
> A simple example to reproduce the issue:
> Let's use only one cache, identified by Release Signal ID "A".
> 1) Send 2 signals to cache "A", both with counter named "counter_1".
> 2) Also send 1 signal to cache "A" with counter named "counter_2".
> At this state, the cache looks like this:
> counter_1 -> 2
> counter_2 -> 1
> If we send 1 flowfile to the corresponding Wait processor, that looks for 
> "counter_1" in cache "A", after the flowfile passes the Wait processor, the 
> value of "counter_1" gets decremented to 0 instead of 1.
> It can be checked in debug mode. It can also be checked on the UI by sending 
> another flowfile to the Wait processor and checking the value of the counter 
> attributes that get appended to it.
> The problem seems to come from this line in the WaitNotifyProtocol class:
> {color:#000080}final long {color}reducedSignalCount = signalCount % 
> requiredCountForPass;



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to