Skip to content

Commit

Permalink
NIFI-12528: This closes apache#8180. Fixed bug that resulted in Stack…
Browse files Browse the repository at this point in the history
…OverflowError when deleting loop containing only funnels

Signed-off-by: Joseph Witt <[email protected]>
  • Loading branch information
markap14 authored and joewitt committed Dec 21, 2023
1 parent 2897618 commit c41b273
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -500,6 +501,16 @@ public void verifyCanDelete() {
}

private void verifySourceStoppedOrFunnel(final Connection connection) {
verifySourceStoppedOrFunnel(connection, new HashSet<>());
}

private void verifySourceStoppedOrFunnel(final Connection connection, final Set<Connection> connectionsSeen) {
final boolean added = connectionsSeen.add(connection);
if (!added) {
// If we've already seen this Connection, no need to process it again.
return;
}

final Connectable sourceComponent = connection.getSource();
if (!sourceComponent.isRunning()) {
return;
Expand All @@ -513,7 +524,7 @@ private void verifySourceStoppedOrFunnel(final Connection connection) {

// Source is a funnel and is running. We need to then check all of its upstream components.
for (final Connection incoming : sourceComponent.getIncomingConnections()) {
verifySourceStoppedOrFunnel(incoming);
verifySourceStoppedOrFunnel(incoming, connectionsSeen);
}
}

Expand Down

0 comments on commit c41b273

Please sign in to comment.