danny0405 commented on code in PR #19432:
URL: https://github.com/apache/hudi/pull/19432#discussion_r3689002124


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/StreamWriteOperatorCoordinator.java:
##########
@@ -254,8 +254,12 @@ public void start() throws Exception {
       }
       restoreEvents(Long.MAX_VALUE);
     } catch (Throwable throwable) {
-      log.error("Failed to start operator coordinator.", throwable);
-      context.failJob(throwable);
+      // Rethrow instead of context.failJob(): failJob triggers an in-graph 
global failover that
+      // keeps this same coordinator instance alive without calling start() 
again, leaving the
+      // half-initialized null fields (executor, writeClient, metaClient ...) 
to be reused and NPE
+      // later. Rethrowing surfaces the failure as a JobMaster start failure 
so the partially
+      // initialized instance is discarded rather than kept serving.
+      throw new HoodieException("Failed to start operator coordinator.", 
throwable);

Review Comment:
   [P1] Preserve fatal errors instead of wrapping them
   
   Because this catch handles `Throwable`, it also wraps `OutOfMemoryError`, 
`InternalError`, `UnknownError`, and `ThreadDeath` in a `HoodieException`. 
Flink `DefaultOperatorCoordinatorHandler.startOperatorCoordinators(...)` calls 
`ExceptionUtils.rethrowIfFatalErrorOrOOM(t)` on the top-level throwable only, 
so the wrapper prevents these fatal conditions from being recognized and 
downgrades them to a recoverable JobMaster startup failure. Please either catch 
`Exception` here (letting `Error`s propagate) or call 
`ExceptionUtils.rethrowIfFatalErrorOrOOM(throwable)` before constructing the 
wrapper.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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