MartijnVisser commented on code in PR #29230:
URL: https://github.com/apache/flink/pull/29230#discussion_r4799009494
##########
flink-core/src/main/java/org/apache/flink/api/java/ClosureCleaner.java:
##########
@@ -270,6 +291,27 @@ private static String
getSuperClassOrInterfaceName(Class<?> cls) {
return null;
}
}
+
+ private static String formatReferencePath(
+ Deque<Field> referencePath, Class<?> nonSerializableClass) {
+ final StringBuilder path =
+ new StringBuilder("\nReference path:")
+ .append("\n\t- object not serializable (class: ")
Review Comment:
For a culprit inside a collection, array or lambda, this names the object
the cleaner stopped at, and the CLI prints nothing else. I think the class
should come from the `NotSerializableException` in `e`.
##########
flink-core/src/main/java/org/apache/flink/api/java/ClosureCleaner.java:
##########
@@ -135,11 +144,17 @@ && needsRecursion(f, fieldObject)) {
LOG.debug("Dig to clean the {}",
fieldObject.getClass().getName());
}
- clean(
- fieldObject,
- ExecutionConfig.ClosureCleanerLevel.RECURSIVE,
- true,
- visited);
+ referencePath.addLast(f);
+ try {
+ clean(
+ fieldObject,
+ ExecutionConfig.ClosureCleanerLevel.RECURSIVE,
+ true,
+ visited,
+ referencePath);
+ } finally {
+ referencePath.removeLast();
Review Comment:
Dropping this `removeLast()` keeps `ClosureCleanerTest` green. Could the
test add a field that cleaning makes serializable, declared before the failing
one? Without `removeLast()` the path then shows that field too.
--
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]