Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B1DE10D19 for ; Tue, 16 Dec 2014 21:33:36 +0000 (UTC) Received: (qmail 15398 invoked by uid 500); 16 Dec 2014 21:33:36 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 15355 invoked by uid 500); 16 Dec 2014 21:33:36 -0000 Mailing-List: contact issues-help@flink.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.incubator.apache.org Delivered-To: mailing list issues@flink.incubator.apache.org Received: (qmail 15346 invoked by uid 99); 16 Dec 2014 21:33:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Dec 2014 21:33:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 16 Dec 2014 21:33:35 +0000 Received: (qmail 15245 invoked by uid 99); 16 Dec 2014 21:33:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Dec 2014 21:33:15 +0000 Date: Tue, 16 Dec 2014 21:33:14 +0000 (UTC) From: "Stephan Ewen (JIRA)" To: issues@flink.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (FLINK-1325) Add a closure cleaner for Java MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FLINK-1325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stephan Ewen resolved FLINK-1325. --------------------------------- Resolution: Fixed Fix Version/s: 0.8-incubating Implemented in 486cc908ad24c86efe1dfe341c3e8266fe9c988d > Add a closure cleaner for Java > ------------------------------ > > Key: FLINK-1325 > URL: https://issues.apache.org/jira/browse/FLINK-1325 > Project: Flink > Issue Type: Improvement > Components: Java API > Reporter: Stephan Ewen > Assignee: Aljoscha Krettek > Fix For: 0.8-incubating > > > The Java API could really need a simple closure cleaner. > All functions that are implemented as anonymous subclasses hold a reference to the enclosing class, unless they are implemented as part of a static method. > That reference (called {{this$0}}) causes serialization to fail, as it draws non serializable classes into the function, even in cases where the function makes no access to the enclosing data. > It is possible to manually set this reference to {{null}}, using reflection, or using a debugger. Then the serialization succeeds. > I suggest to add a closure cleaner that uses an ASM visitor over the function's code to see if there is any access to the {{this$0}} field. In case there is non, the field should be set to {{null}}. > The problem can be reproduced with the simple program below: > {code} > public class Test { > public void runProgram() throws Exception { > ExecutionEnvironment env = ExecutionEnvironment .getExecutionEnvironment(); > env.generateSequence(1, 10) > .map(new MapFunction() { > public Long map(Long value) { > return value * 2; > } > }) > .print(); > env.execute(); > } > public static void main(String[] args) throws Exception { > new Test().runProgram(); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)