nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (Jira)" <>
Subject [jira] [Commented] (NIFI-6395) CountText processor is not thread safe - concurrency error
Date Tue, 05 Nov 2019 12:02:00 GMT


ASF subversion and git services commented on NIFI-6395:

Commit 7f96fa1d0dbcfd061fba1e061c891ac35da4333d in nifi's branch refs/heads/master from Ivan
Ezequiel Rodriguez
[;h=7f96fa1 ]

NIFI-6395: Thread-safety bug fixed and added new flag property to handle the way to adjust
the counters


Local variable changes by AtomicInteger

NIFI-6395 - Fix line is longer than 200 characters

This closes #3552.

Signed-off-by: Koji Kawamura <>

> CountText processor is not thread safe - concurrency error
> ----------------------------------------------------------
>                 Key: NIFI-6395
>                 URL:
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.9.2
>         Environment: software platform
>            Reporter: Iván Ezequiel Rodriguez
>            Assignee: Iván Ezequiel Rodriguez
>            Priority: Major
>              Labels: concurrency, count, error, processor, text, thread-safe
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
> The processor counters fail to execute multiple threads. The programming is not safe
since they are not atomic operations. They are using a volatile instance variable accessed
by multiple threads when onTrigger is called. The solution is to declare those local variables
to onTrigger. Perform several tests with millions of records and the counter does not work
correctly when it is executed with more than one task.
> The problem is in the declaration of these instance variables:
> private *volatile int* lineCount;
>  private *volatile int* lineNonEmptyCount;
>  private *volatile int* wordCount;
>  private *volatile int* characterCount;
> This is not safe to perform atomic operations on these variables. As a result the counters
register less amount of lines when executed with multiple threads.
> I propose the following solution:
> [Fix bug pull request|]
> problem graph:
> [!|width=640,height=353!|]

This message was sent by Atlassian Jira

View raw message