Return-Path: X-Original-To: apmail-flink-dev-archive@www.apache.org Delivered-To: apmail-flink-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E4C118C89 for ; Thu, 21 Jan 2016 11:05:58 +0000 (UTC) Received: (qmail 91210 invoked by uid 500); 21 Jan 2016 11:05:58 -0000 Delivered-To: apmail-flink-dev-archive@flink.apache.org Received: (qmail 91150 invoked by uid 500); 21 Jan 2016 11:05:58 -0000 Mailing-List: contact dev-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list dev@flink.apache.org Received: (qmail 91139 invoked by uid 99); 21 Jan 2016 11:05:58 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jan 2016 11:05:58 +0000 Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 79ED31A0019 for ; Thu, 21 Jan 2016 11:05:57 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id u188so221358830wmu.1 for ; Thu, 21 Jan 2016 03:05:57 -0800 (PST) X-Gm-Message-State: ALoCoQnMPHFnOclEPcOw2ZN8ZNQ27e+lq12mojs+ORZHMhFC9YLDa2vlvmSjDGU9AibS9vHJDmsyLx91Bys+TNogQ+QStiaWrg== MIME-Version: 1.0 X-Received: by 10.194.118.138 with SMTP id km10mr46480109wjb.57.1453374356139; Thu, 21 Jan 2016 03:05:56 -0800 (PST) Received: by 10.28.13.209 with HTTP; Thu, 21 Jan 2016 03:05:56 -0800 (PST) In-Reply-To: <56A0B242.4040005@dfki.de> References: <56A0A947.1060406@dfki.de> <56A0B242.4040005@dfki.de> Date: Thu, 21 Jan 2016 12:05:56 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Stackoverflow in Serialization From: Till Rohrmann To: dev@flink.apache.org Content-Type: multipart/alternative; boundary=089e011764313938ec0529d6168b --089e011764313938ec0529d6168b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable As you can see from the namespace and the object names, it's not our code which causes the stack overflow. It's Kryo code which you're calling and thus we have not control over it. And in fact, I doubt that the problem is related to the number of elements in your map but rather to the structure of the types. My guess is that you have a type which contains a field of another type, which contains a field of another type, and so on. You should check that. Cheers, Till On Thu, Jan 21, 2016 at 11:26 AM, Hilmi Yildirim wrote: > Hi, > I have a complex object with a MutableList and a Map containing thousands > of objects. Here is a snippet of the exception. The actual exception is > much longer. There, you can see that the exception is caused by too many > recursive calls. For each recursive call the stack size increases because > the parameters of each resursion level are saved on the stack. I am not > sure but I suggest that the Map is the problem. > > Exception in thread "main" java.lang.StackOverflowError > at com.esotericsoftware.kryo.Kryo.getRegistration(Kryo.java:445) > at > com.esotericsoftware.kryo.util.DefaultClassResolver.writeClass(DefaultCla= ssResolver.java:79) > at com.esotericsoftware.kryo.Kryo.writeClass(Kryo.java:488) > at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:593) > at com.twitter.chill.Tuple2Serializer.write(TupleSerializers.scala:36= ) > at com.twitter.chill.Tuple2Serializer.write(TupleSerializers.scala:33= ) > at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:523) > at > com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:= 61) > at > com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializ= er.java:495) > at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:523) > at > com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:= 61) > at > com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializ= er.java:495) > at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:523) > at > com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:= 61) > at > com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializ= er.java:495) > at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:523) > > > > Best Regards, > Hilmi > > > > > > > Am 21.01.2016 um 11:14 schrieb Till Rohrmann: > >> Hi Hilmi, >> >> I've never seen such a problem. Could you please provide a bit more >> background information. Which types are you serializing? Which serialize= r >> are you using? What do you mean with recursion? Maybe you can provide a >> simple example program which reproduces the problem. >> >> The thing is that if you have a composite data type, then each field wil= l >> be serialized with it's own serializer. Thus, if you data type is strong= ly >> nested, then you will end up with a long chain of nested serializer call= s. >> In order to cause a stack overflow exception, you would have to have a >> really deeply nested data structure. Maybe you can flatten it a bit. >> >> Cheers, >> Till >> >> On Thu, Jan 21, 2016 at 10:47 AM, Hilmi Yildirim >> wrote: >> >> Hi, >>> I am using flink to train a ML model. There, I need to broadcast huge >>> broadcast variables in each iteration. During the serialization I get a >>> Stackoverflow exception. If I increase the Stack size then it works wel= l. >>> The Stackoverflow could be avoided If you do not use recursion in >>> serialization. You could use iterations instead, I know it is more >>> complex >>> but this would avoid a stack overflow. >>> >>> Best Regards, >>> Hilmi >>> >>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Hilmi Yildirim, M.Sc. > Researcher > > DFKI GmbH > Intelligente Analytik f=C3=BCr Massendaten > DFKI Projektb=C3=BCro Berlin > Alt-Moabit 91c > D-10559 Berlin > Phone: +49 30 23895 1814 > > E-Mail: Hilmi.Yildirim@dfki.de > > ------------------------------------------------------------- > Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH > Firmensitz: Trippstadter Strasse 122, D-67663 Kaiserslautern > > Geschaeftsfuehrung: > Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender) > Dr. Walter Olthoff > > Vorsitzender des Aufsichtsrats: > Prof. Dr. h.c. Hans A. Aukes > > Amtsgericht Kaiserslautern, HRB 2313 > ------------------------------------------------------------- > > -- > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Hilmi Yildirim, M.Sc. > Researcher > > DFKI GmbH > Intelligente Analytik f=C3=BCr Massendaten > DFKI Projektb=C3=BCro Berlin > Alt-Moabit 91c > D-10559 Berlin > Phone: +49 30 23895 1814 > > E-Mail: Hilmi.Yildirim@dfki.de > > ------------------------------------------------------------- > Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH > Firmensitz: Trippstadter Strasse 122, D-67663 Kaiserslautern > > Geschaeftsfuehrung: > Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender) > Dr. Walter Olthoff > > Vorsitzender des Aufsichtsrats: > Prof. Dr. h.c. Hans A. Aukes > > Amtsgericht Kaiserslautern, HRB 2313 > ------------------------------------------------------------- > > --089e011764313938ec0529d6168b--