imbajin commented on code in PR #814:
URL: 
https://github.com/apache/hugegraph-toolchain/pull/814#discussion_r4266874785


##########
hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/entity/load/LoadTask.java:
##########
@@ -177,18 +178,57 @@ public void run() {
         Ex.check(this.options != null, "The load options shouldn't be null");
         log.info("LoadTask is start running : {}", this.id);
 
-        boolean noError;
+        boolean noError = false;
+        boolean cleanupFailed = false;
+        Throwable failure = null;
         try {
             noError = this.loader.load();
         } catch (Throwable e) {
-            noError = false;
-            log.error("Run task {} failed", this.id, e);
+            failure = e;
+        } finally {
+            Throwable recordedFailure = failure;
+            if (failure != null) {
+                // Only read the recorded error: shutdown can wrap a checked
+                // failure differently from load(), or rethrow it unchanged.
+                try {
+                    this.context().throwIfFailed();
+                } catch (Throwable recorded) {
+                    recordedFailure = recorded;
+                    if (recorded != failure) {
+                        // Retain an asynchronously recorded error even when it
+                        // differs from the error propagated by load().
+                        log.error("Recorded load failure for task {}", 
this.id, recorded);
+                    }
+                }
+            }
+            Throwable recordedCause = recordedFailure == null ? null : 
recordedFailure.getCause();
+            int suppressed = recordedFailure == null ? 0 : 
recordedFailure.getSuppressed().length;
+            int causeSuppressed = recordedCause == null ? 0 : 
recordedCause.getSuppressed().length;
+            try {
+                this.loader.shutdown();
+            } catch (Throwable e) {
+                noError = false;
+                cleanupFailed = !sameLoadFailure(recordedFailure, e) ||

Review Comment:
   Fixed in the current source. A failed mode reset now remains the primary 
shutdown failure while the recorded loading/ordinary close failure is preserved 
as suppressed. A successful reset still rethrows the exact original loading 
failure. A directly thrown cleanup Error keeps its identity and precedence; 
self-suppression and new cause/suppressed cycles are guarded.
   
   The regression uses an actual HugeGraphLoader, LoadContext, worker pools and 
HTTP transport with a controlled mode endpoint: the 
recorded-failure/reset-rejection case failed on the previous source and now 
passes. It also checks the successful-reset identity, terminated pools, closed 
transport/connections, removed hook and an idempotent second shutdown. The 
complete Client/Loader suites, related reactor compilation, formatting, strict 
changed-file checks and the same three independent reviews pass. Fatal-boundary 
controls inject Error after real client closure; they do not claim a real 
Server fatal response. The unrelated uncached Spark plugin still prevents an 
offline all-module build.
   
   This SDK fix does not close the separate delete/Async integration work or 
remove the paired owner-API dependency.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to