git上拉取的exproto-svr-java源码一直断开重连

环境信息

  • EMQ X 版本:4.3.5
  • 操作系统及版本:centos 7
  • 其他

问题描述

git上拉取的exproto-svr-java源码,调试,用tcp客户端连到emqx 7993端口,发送数据。tcp连接一会儿就断开了。

配置文件及日志

exproto-svr-java日志

[LOG] client socket connection:peername {
  host: "192.168.159.1"
  port: 9412
}
sockname {
  host: "192.168.159.11"
  port: 7993
}

[LOG] authenticate code: 0
[LOG] startTimer code: 0
[LOG] subscribe  code: 0
 onSocketCreated error causenull
 onSocketCreated error messageCANCELLED: client cancelled
[LOG] ReceivedBytesRequest:g1hkAA5lbXF4QDEyNy4wLjAuMQAAFMkAAAAAAAAAAQ==
[LOG] publish  code: 0
[LOG] ReceivedBytesRequest:g1hkAA5lbXF4QDEyNy4wLjAuMQAAFMkAAAAAAAAAAQ==
[LOG] publish  code: 0
[LOG] ReceivedBytesRequest:g1hkAA5lbXF4QDEyNy4wLjAuMQAAFMkAAAAAAAAAAQ==
[LOG] publish  code: 0
[LOG] ReceivedBytesRequest:g1hkAA5lbXF4QDEyNy4wLjAuMQAAFMkAAAAAAAAAAQ==
[LOG] publish  code: 0
[LOG] ReceivedBytesRequest:g1hkAA5lbXF4QDEyNy4wLjAuMQAAFMkAAAAAAAAAAQ==
[LOG] publish  code: 0
 onReceivedBytes error causenull
 onReceivedBytes error messageCANCELLED: client cancelled

emqx的日志

2021-12-28T17:02:00.404601+08:00 [error] [ExProto gClient] Send to on_socket_created method failure, request: #{conn => <<"g1hkAA5lbXF4QDEyNy4wLjAuMQAAFJgAAAAAAAAAAQ==">>,conninfo => #{peername => #{host => "192.168.159.1",port => 9269},sockname => #{host => "192.168.159.11",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,689}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,765}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
2021-12-28T17:02:00.405287+08:00 [error] supervisor: 'esockd_connection_sup - <0.3621.0>', errorContext: connection_shutdown, reason: {error,{on_socket_created,not_found}}, offender: [{pid,<0.5272.0>},{name,connection},{mfargs,{emqx_exproto_conn,start_link,[[{handler,'protoname:tcp'},{active_n,100},{idle_timeout,30000},{max_conn_rate,1000}]]}}]
2021-12-28T17:02:00.406094+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,cancel,'Stream reset by server.'}, stream: #stream{st={open,idle}, buff_size=0, mqueue=[]}
2021-12-28T17:02:05.404229+08:00 [error] [ExProto gClient] Send to on_socket_created method failure, request: #{conn => <<"g1hkAA5lbXF4QDEyNy4wLjAuMQAAFJsAAAAAAAAAAQ==">>,conninfo => #{peername => #{host => "192.168.159.1",port => 9279},sockname => #{host => "192.168.159.11",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,689}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,765}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
2021-12-28T17:02:05.404920+08:00 [error] supervisor: 'esockd_connection_sup - <0.3621.0>', errorContext: connection_shutdown, reason: {error,{on_socket_created,not_found}}, offender: [{pid,<0.5275.0>},{name,connection},{mfargs,{emqx_exproto_conn,start_link,[[{handler,'protoname:tcp'},{active_n,100},{idle_timeout,30000},{max_conn_rate,1000}]]}}]
2021-12-28T17:02:10.408297+08:00 [error] test@192.168.159.1:9287 [Hooks] Failed to execute {emqx_mod_presence,on_client_connected,[[{qos,1}]]}: {error,function_clause,[{emqx_mod_presence,connected_presence,[#{anonymous => true,auth_result => success,clientid => <<"test">>,is_bridge => false,is_superuser => false,mountpoint => <<>>,peerhost => {192,168,159,1},protocol => <<>>,sockport => 7993,username => <<"test">>,zone => external},#{clean_start => true,clientid => <<"test">>,conn_mod => undefined,conn_props => #{},connected => true,connected_at => 1640682130408,expiry_interval => 0,keepalive => 0,peercert => nossl,peername => {{192,168,159,1},9287},...}],[{file,"emqx_mod_presence.erl"},{line,84}]},{emqx_mod_presence,on_client_connected,3,[{file,"emqx_mod_presence.erl"},{line,55}]},{emqx_hooks,safe_execute,2,[{file,"emqx_hooks.erl"},{line,191}]},{emqx_hooks,do_run,2,[{file,"emqx_hooks.erl"},{line,157}]},{emqx_exproto_channel,ensure_connected,1,[{file,"emqx_exproto_channel.erl"},{line,468}]},{emqx_exproto_channel,handle_call,2,[{file,"emqx_exproto_channel.erl"},{line,281}]},{emqx_exproto_conn,handle_call,3,[{file,"emqx_exproto_conn.erl"},{line,488}]},{emqx_exproto_conn,handle_msg,2,[{file,"emqx_exproto_conn.erl"},{line,360}]},{emqx_exproto_conn,process_msg,3,[{file,[...]},{line,...}]},{proc_lib,wake_up,3,[{file,...},{...}]}]}
2021-12-28T17:02:15.410325+08:00 [error] [gRPC Client] Stream shutdown reason: {stream_error,cancel,'Stream reset by server.'}, stream: #stream{st={open,idle}, buff_size=0, mqueue=[]}


看起来是 exproto-svr-java 这个服务有问题,你那边可以跟着 README 在看看,能不能跑起来

ps: 如果还有问题,记得发下你这边拉的 exproto-svr-java 的分支