Thrift binary protocol bug

250 views Asked by At

I'm trying to use thrift for python / java interop. I decided to use the binary protocol as a default.

When I'm calling a java service from python, everything works fine. However, if I call a python service from java, then there seems to be an encoding error (which isn't present for other protocols - e.g. compact)

Generated python code has a function that processes every method name:

 def str_to_binary(str_val):
        return bytes(str_val, 'utf8')

This results in an error TypeError: encoding without a string argument when called by Java.

The error seems to be due to the fact that python is expecting a utf8 encoded string there (which it'll convert to bytes), but java sends raw bytes (I see b"method-name" in the debugger).

Which of the two implementations is doing it correctly? In case of compact protocol, it is string, so I believe java binary protocol sending is at fault.

0

There are 0 answers