forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-8466] [runtime] Make sure ErrorInfo references no user-defined…
… classes. That way, holding on to the ErrorInfo does not prevent class unloading. However, this implies that the ErrorInfo must not hold strong references to any Exception classes. For that reason, the commit pull the "ground truth" exception into a separate fields, so that the ExecutionGraph logic itself can always assume to have the proper ground-truth exception. This closes apache#5348
- Loading branch information
1 parent
012413c
commit 524c501
Showing
12 changed files
with
107 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ErrorInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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.executiongraph; | ||
|
||
import org.apache.flink.core.testutils.CommonTestUtils; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.Serializable; | ||
import java.net.URL; | ||
import java.net.URLClassLoader; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Simple test for the {@link ErrorInfo}. | ||
*/ | ||
public class ErrorInfoTest { | ||
|
||
@Test | ||
public void testSerializationWithExceptionOutsideClassLoader() throws Exception { | ||
final ErrorInfo error = new ErrorInfo(new ExceptionWithCustomClassLoader(), System.currentTimeMillis()); | ||
final ErrorInfo copy = CommonTestUtils.createCopySerializable(error); | ||
|
||
assertEquals(error.getTimestamp(), copy.getTimestamp()); | ||
assertEquals(error.getExceptionAsString(), copy.getExceptionAsString()); | ||
assertEquals(error.getException().getMessage(), copy.getException().getMessage()); | ||
|
||
} | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
private static final class ExceptionWithCustomClassLoader extends Exception { | ||
|
||
private static final long serialVersionUID = 42L; | ||
|
||
private static final ClassLoader CUSTOM_LOADER = new URLClassLoader(new URL[0]); | ||
|
||
@SuppressWarnings("unused") | ||
private final Serializable outOfClassLoader = CommonTestUtils.createObjectForClassNotInClassPath(CUSTOM_LOADER); | ||
|
||
public ExceptionWithCustomClassLoader() { | ||
super("tada"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters