Hi all,
I'm using a oneway
modifier in one of my Thrift function definitions:
...
oneway void secret_function(1: string x, 2: string y),
...
When generating the respective Erlang code via Thrift, this is translated into:
...
function_info('secret_function', reply_type) ->
oneway_void;
function_info('secret_function', exceptions) ->
{struct, []};
...
Please note the oneway_void
atom there.
When the secret_function
function is executed, I get the following error:
=ERROR REPORT==== 2-Sep-2010::18:17:08 ===
oneway void secret_function threw error which must be ignored: {error,
function_clause,
[{thrift_protocol,
term_to_typeid,
[oneway_void]},
{thrift_protocol,
struct_write_loop,
3},
{thrift_protocol,
write,2},
{thrift_processor,
send_reply,
4},
{thrift_processor,
handle_function,
2},
{thrift_processor,
loop,1}]}
Independently from the possible bugs contained in the user code, here the thrift_protocol:term_to_typeid/1
function is being called with the oneway_void
atom as an argument, which causes a function clause. In fact, reading from the code (thrift_protocol.erl):
...
term_to_typeid(void) -> ?tType_VOID;
term_to_typeid(bool) -> ?tType_BOOL;
term_to_typeid(byte) -> ?tType_BYTE;
term_to_typeid(double) -> ?tType_DOUBLE;
term_to_typeid(i16) -> ?tType_I16;
term_to_typeid(i32) -> ?tType_I32;
term_to_typeid(i64) -> ?tType_I64;
term_to_typeid(string) -> ?tType_STRING;
term_to_typeid({struct, _}) -> ?tType_STRUCT;
term_to_typeid({map, _, _}) -> ?tType_MAP;
term_to_typeid({set, _}) -> ?tType_SET;
term_to_typeid({list, _}) -> ?tType_LIST.
...
A bug? Any other explanation? Why is oneway_void
being passed to that function?