aljoscha commented on issue #8280: [FLINK-12297]Harden ClosureCleaner to handle 
the wrapped function
URL: https://github.com/apache/flink/pull/8280#issuecomment-499001498
 
 
   I still think the approach doesn't work for closures that are nested in 
"non-closures". I.e when you have a closure as a field in an object of a static 
class. This test case shows it:
   
   ```
        @Test
        public void 
testRealOuterStaticClassInnerStaticClassInnerAnonymousOrLocalClass() {
                MapFunction<Integer, Integer> nestedMap = new 
OuterMapCreator().getMap();
   
                MapFunction<Integer, Integer> wrappedMap = new 
WrapperMapFunction(nestedMap);
   
                Tuple1<MapFunction<Integer, Integer>> tuple = new 
Tuple1<>(wrappedMap);
   
                ClosureCleaner.clean(tuple, 
ExecutionConfig.ClosureCleanerLevel.RECURSIVE, true);
   
                ClosureCleaner.ensureSerializable(tuple);
        }
   ```
   
   The problem is that recursion stops as soon as it finds a field of a static 
class, which doesn't take into account the fact that this nested static class 
can have fields that are themselves closures.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to