You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/03 15:07:34 UTC

[GitHub] [flink] echauchot commented on a change in pull request #18610: [FLINK-23843][runtime] Properly fail the job when SplitEnumeratorContext.runInCoordinatorThread() throws an exception

echauchot commented on a change in pull request #18610:
URL: https://github.com/apache/flink/pull/18610#discussion_r818749232



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/util/FailJobExceptionHandler.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.function.Consumer;
+
+/**
+ * Handler for uncaught exceptions that will log the exception and fail the job afterwards.
+ *
+ * <p>This guarantees that critical exceptions are not accidentally lost and leave the system
+ * running in an inconsistent state.
+ */
+public final class FailJobExceptionHandler implements Thread.UncaughtExceptionHandler {

Review comment:
       Name is a leftover of the time it actually called the `context.failjob()` now that we changed it to `Cosumer<Throwable>` I agree it is misleading and BTW it is a class not a lambda because the is already exception handlers in the code base so I wanted to be consistent.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org