You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Manu Zhang <ow...@gmail.com> on 2016/10/31 03:51:50 UTC

migrating gearpump-runner to new DoFn fails with NotSerializableException

Hi all,

I'm migrating `OldDoFn` to `DoFn` in gearpump-runner. We serialize all the
functions locally and ship to remote cluster. Hence, I try to make sure the
functions are serializable. Unluckily, the integration-tests fail with
`NotSerializableException` as follows. Anyone knows what that
*AddTimestampsDoFn$auxiliary$x5sQZaqi
is *?

Caused by: java.io.NotSerializableException:
org.apache.beam.sdk.transforms.WithTimestamps$AddTimestampsDoFn$auxiliary$x5sQZaqi
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at
org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray(SerializableUtils.java:49)
        ... 83 more

Thanks,
Manu

Re: migrating gearpump-runner to new DoFn fails with NotSerializableException

Posted by Manu Zhang <ow...@gmail.com>.
Thanks Kenn. That is indeed the problem.

Manu

On Mon, Oct 31, 2016 at 12:12 PM Kenneth Knowles <kl...@google.com.invalid>
wrote:

> Hi Manu,
>
> That class is generated by DoFnInvokers, which generates bytecode to
> efficiently execute a DoFn. It should not be part of the serialized
> payload, but should be instantiated on the service/worker/etc. If you are
> trying to serialize a DoFnInvoker, then my recommendation is to serialize
> only the DoFn. If this is caused by something else, then can you provide
> some more details? Perhaps even open a pull request (where tests will fail,
> of course) so I can see and comment on the code itself.
>
> Kenn
>
> On Sun, Oct 30, 2016 at 8:52 PM Manu Zhang <ow...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I'm migrating `OldDoFn` to `DoFn` in gearpump-runner. We serialize all
> the
> > functions locally and ship to remote cluster. Hence, I try to make sure
> the
> > functions are serializable. Unluckily, the integration-tests fail with
> > `NotSerializableException` as follows. Anyone knows what that
> > *AddTimestampsDoFn$auxiliary$x5sQZaqi
> > is *?
> >
> > Caused by: java.io.NotSerializableException:
> >
> >
> org.apache.beam.sdk.transforms.WithTimestamps$AddTimestampsDoFn$auxiliary$x5sQZaqi
> >         at
> > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> >         at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> >         at
> > java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> >         at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> >         at
> > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> >         at
> > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> >         at
> >
> >
> org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray(SerializableUtils.java:49)
> >         ... 83 more
> >
> > Thanks,
> > Manu
> >
>

Re: migrating gearpump-runner to new DoFn fails with NotSerializableException

Posted by Kenneth Knowles <kl...@google.com.INVALID>.
Hi Manu,

That class is generated by DoFnInvokers, which generates bytecode to
efficiently execute a DoFn. It should not be part of the serialized
payload, but should be instantiated on the service/worker/etc. If you are
trying to serialize a DoFnInvoker, then my recommendation is to serialize
only the DoFn. If this is caused by something else, then can you provide
some more details? Perhaps even open a pull request (where tests will fail,
of course) so I can see and comment on the code itself.

Kenn

On Sun, Oct 30, 2016 at 8:52 PM Manu Zhang <ow...@gmail.com> wrote:

> Hi all,
>
> I'm migrating `OldDoFn` to `DoFn` in gearpump-runner. We serialize all the
> functions locally and ship to remote cluster. Hence, I try to make sure the
> functions are serializable. Unluckily, the integration-tests fail with
> `NotSerializableException` as follows. Anyone knows what that
> *AddTimestampsDoFn$auxiliary$x5sQZaqi
> is *?
>
> Caused by: java.io.NotSerializableException:
>
> org.apache.beam.sdk.transforms.WithTimestamps$AddTimestampsDoFn$auxiliary$x5sQZaqi
>         at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
>         at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
>         at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
>         at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
>         at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
>         at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
>         at
>
> org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray(SerializableUtils.java:49)
>         ... 83 more
>
> Thanks,
> Manu
>