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 c41b273e82 NIFI-12528: This closes #8180. Fixed bug that resulted in StackOverflowError when deleting loop containing only funnels c41b273e82 is described below commit c41b273e82c69466d4e518b814964883289edba7 Author: Mark Payne <marka...@hotmail.com> AuthorDate: Thu Dec 21 11:07:39 2023 -0500 NIFI-12528: This closes #8180. Fixed bug that resulted in StackOverflowError when deleting loop containing only funnels Signed-off-by: Joseph Witt <joew...@apache.org> --- .../org/apache/nifi/connectable/StandardConnection.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java index a2a6185b7b..9ef3b9fa39 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/connectable/StandardConnection.java @@ -41,6 +41,7 @@ import org.apache.nifi.remote.RemoteGroupPort; 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; @@ -500,6 +501,16 @@ public final class StandardConnection implements Connection { } 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; @@ -513,7 +524,7 @@ public final class StandardConnection implements 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); } }