This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 7ff7070 NIFI-9790: This closes #5860. Fixed race condition in which
SwappablePriorityQueue could attempt to access the 0th element of an empty
collection
7ff7070 is described below
commit 7ff70706ee6c9b3ea1c508701936c07bb0e6da40
Author: Mark Payne <[email protected]>
AuthorDate: Fri Mar 11 16:28:31 2022 -0500
NIFI-9790: This closes #5860. Fixed race condition in which
SwappablePriorityQueue could attempt to access the 0th element of an empty
collection
Signed-off-by: Joe Witt <[email protected]>
---
.../java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java | 2 ++
1 file changed, 2 insertions(+)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java
index 81e96c8..c8f2b18 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java
@@ -460,6 +460,8 @@ public class SwappablePriorityQueue {
// Because we cannot obtain the write lock while already
holding the read lock, we set a flag so that we
// can migrate swap to active queue only after we've
released the read lock.
mustMigrateSwapToActive = true;
+ } else if (swapQueue.isEmpty()) {
+ return FlowFileAvailability.ACTIVE_QUEUE_EMPTY;
} else {
top = swapQueue.get(0);
}