Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/134#discussion_r139702066
--- Diff: libminifi/include/core/Processor.h ---
@@ -153,7 +154,8 @@ class Processor : public Connectable, public
ConfigurableComponent, public std::
}
// decrement Active Task Counts
void decrementActiveTask(void) {
- active_tasks_--;
+ if (active_tasks_ > 0)
+ active_tasks_--;
--- End diff --
Since the input ( stop command for example ) is user provided, this is only
a protection. Decrement only occurs when an exception occurs during on trigger.
If this happens just after unschedule occurs ( and the active tasks is set to 0
) then we could arrive at -1. I didn't want to impose additional locking.
Not ideal, and this can be solved more elegantly by not decrementing active
tasks during an exception since the number isn't currently important ( just
that tasks > 0 )...but I did not want to make additional changes here.
---