markap14 commented on code in PR #10749:
URL: https://github.com/apache/nifi/pull/10749#discussion_r2676649225


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorNode.java:
##########
@@ -225,7 +226,18 @@ private ConnectorValueReference createValueReference(final 
VersionedConnectorVal
 
     @Override
     public void applyUpdate() throws FlowUpdateException {
-        applyUpdate(workingFlowContext);
+        try {
+            applyUpdate(workingFlowContext);
+        } catch (final Throwable t) {
+            // Since we failed to update, make sure that we stop the Connector.
+            try (final NarCloseable ignored = 
NarCloseable.withComponentNarLoader(extensionManager, 
connectorDetails.getConnector().getClass(), getIdentifier())) {
+                connectorDetails.getConnector().stop(activeFlowContext);

Review Comment:
   The Connector will *probably* be stopped at this point, but it's not 
guaranteed. Because the Connector gets the chance to do what is necessary to 
prepare for an update, it may not have stopped all of the components (the 
abstract implementation does but it could be overridden). So at this point, we 
could be in a potentially unknown number of components so if the update fails 
we should stop to ensure that it's in a known state.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to