emqx_exproto gRpc C# 获取报文异常

环境信息

  • EMQ X 版本:4.3.5
  • 操作系统及版本:windows
  • 其他:用户端开发框架 .NET 5

问题描述

使用TCP工具监听EMQX的7993端口,向其发送数据。emqx_exproto 配置了exproto.listener.protoname1.connection_handler_url = http://127.0.0.1:9000 为我的本机gRpc服务,可以接收到报文,但是收了几次之后,就会报错,如下日志
循环获取流之后就会报以下错误:
1、The request was aborted
2、Can’t read messages after the request is complete.
而后,TCP工具就自动断开了。

配置文件及日志

2021-07-06T16:14:55.331000+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,no_error,'Stream reset by server.'}, stream: #stream{st={open,closed}, buff_size=0, mqueue=[<<>>, {eos, [{<<"grpc-status">>, <<"0">>}]}]}
2021-07-06T16:15:06.397000+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,no_error,'Stream reset by server.'}, stream: #stream{st={open,closed}, buff_size=0, mqueue=[<<>>, {eos, [{<<"grpc-status">>, <<"0">>}]}]}
2021-07-06T16:15:10.471000+08:00 [error] [ExProto gClient] Send to on_received_bytes method failure, request: #{bytes => <<"3333333333333">>,conn => <<"g1hkAA5lbXF4QDEyNy4wLjAuMQAAFjoAAAAAYOJhbA==">>}, stacktrace: [{grpc_client,send,3,[{file,"grpc_client.erl"},{line,185}]},{emqx_exproto_gcli,handle_cast,2,[{file,"emqx_exproto_gcli.erl"},{line,90}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,680}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,756}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
2021-07-06T16:15:10.472000+08:00 [error] supervisor: 'esockd_connection_sup - <0.4046.0>', errorContext: connection_shutdown, reason: {error,{on_received_bytes,not_found}}, offender: [{pid,<0.5690.0>},{name,connection},{mfargs,{emqx_exproto_conn,start_link,[[{handler,'protoname1:tcp'},{active_n,100},{idle_timeout,60000},{max_conn_rate,1000}]]}}]
2021-07-06T16:15:21.314000+08:00 [error] [ExProto gClient] Send to on_socket_created method failure, request: #{conn => <<"g1hkAA5lbXF4QDEyNy4wLjAuMQAAFkMAAAAAYOJhbA==">>,conninfo => #{peername => #{host => "192.168.51.186",port => 52125},sockname => #{host => "192.168.51.186",port => 7993},socktype => 'TCP'}}, stacktrace: [{grpc_client,send,3,[{file,"grpc_client.erl"},{line,185}]},{emqx_exproto_gcli,handle_cast,2,[{file,"emqx_exproto_gcli.erl"},{line,90}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,680}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,756}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
2021-07-06T16:15:21.315000+08:00 [error] supervisor: 'esockd_connection_sup - <0.4046.0>', errorContext: connection_shutdown, reason: {error,{on_socket_created,not_found}}, offender: [{pid,<0.5699.0>},{name,connection},{mfargs,{emqx_exproto_conn,start_link,[[{handler,'protoname1:tcp'},{active_n,100},{idle_timeout,60000},{max_conn_rate,1000}]]}}]
2021-07-06T16:15:22.395000+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,no_error,'Stream reset by server.'}, stream: #stream{st={open,closed}, buff_size=0, mqueue=[<<>>, {eos, [{<<"grpc-status">>, <<"0">>}]}]}
2021-07-06T16:15:26.054000+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,no_error,'Stream reset by server.'}, stream: #stream{st={open,closed}, buff_size=0, mqueue=[<<>>, {eos, [{<<"grpc-status">>, <<"0">>}]}]}

疑似bug,我用java写的, emqx_exproto每个客户端只能回调一次
我感觉是EMQX的服务端处理完,没发送完成的信号给我们。

我用企业版就很正常。现在java这块修复了吗?或是你有其他的方案来处理监听TCP协议啊?

之前企业版的也是不能用, emqx_exproto模块,使用publish报错,现在可能修复了。企业版解决迅速,开源版两个月了,还没处理 :joy:。你会erlang的话,可以帮他修复修复。

erlang不会呀,还是等官方修复吧。可以加你微信吗,以后有问题向你请教请教啊

1349320519