Skip to content

ThriftSerializer.encodeBody() swallows important exceptions #150

Open

Description

@atanasbalevski

Hi,
I just came to notice that the current implementation of the ThriftSerializer.encodeBody() will swallow any exceptions thrown by the validation of the thrift response and only print the exception stack trace:

public ByteBuf encodeBody(Object body) {
try {
TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
byte[] payloadBytes = serializer.serialize((TBase) body);
return Unpooled.wrappedBuffer(payloadBytes);
} catch (TException e) {
e.printStackTrace();
}
return null;
}

I'd rather prefer to have these exceptions handled by the callee, if problem with serialization awareness is needed by the lib clients, however i'm not sure if this behaviour is somehow implied by how tchannel should function

p.s. by doing this, the actual tchannel calls would not get answered, since the responses will not get published. This will result in timeouts on the tchannel callers side

thanks
atanas

Activity

  1. yborovikov commented on Nov 22, 2017

    @yborovikov
    Contributor

    The code now logs the exception (instead of printing the stack trace to stdout).
    Changing it to throw it instead does make sense yet might be a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions