Copilot commented on code in PR #132:
URL: https://github.com/apache/iotdb-extras/pull/132#discussion_r4038104729


##########
iotdb-collector/collector-core/src/main/java/org/apache/iotdb/collector/runtime/task/source/pull/PullSourceTask.java:
##########
@@ -99,8 +99,10 @@ public void createInternal() throws Exception {
           consumers[i].consumer().close();
         } catch (final Exception ex) {
           LOGGER.warn("Failed to close source on creation failure", ex);
-          throw e;
         }
+        // Like SinkTask/ProcessorTask: a source that cannot start must fail 
task creation
+        // instead of being swallowed when its cleanup succeeds.
+        throw e;

Review Comment:
   With `parallelism > 1`, a failure at index `i` leaves all earlier consumers 
and their scheduler tasks running, while this rethrow aborts creation. The 
executor is also left in `REGISTERED_EXECUTOR_SERVICES`; clean up every 
constructed consumer and remove/shutdown that executor before propagating the 
failure.



##########
iotdb-collector/collector-core/src/main/java/org/apache/iotdb/collector/runtime/task/source/push/PushSourceTask.java:
##########
@@ -81,8 +81,10 @@ public void createInternal() throws Exception {
           pushSources[i].close();
         } catch (final Exception ex) {
           LOGGER.warn("Failed to close source on creation failure", ex);
-          throw e;
         }
+        // Like SinkTask/ProcessorTask: a source that cannot start must fail 
task creation
+        // instead of being swallowed when its cleanup succeeds.
+        throw e;

Review Comment:
   When a later parallel source fails to start, this catch block only closes 
`pushSources[i]`; every earlier source has already been started and remains 
active even though task creation now fails. Close all successfully created 
sources (and preserve any cleanup failures) before rethrowing so a partial 
startup cannot leak subscriptions.



-- 
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