EMQX启动3-5个小时后,就会自动停止运行

环境

  • EMQX 版本:5.0.26
  • 操作系统版本:
    CentOS7

重现此问题的步骤

EMQX可以正常启动且正常运行,但每次启动3-5个小时,就会停止运行,DashBoard面板也看不到那种,重新启动又能好3-5小时,发送信息一直是一样的,我看日志中提到了内存占用高,是因为服务器内存过小吗?下面是完整日志:
2023-06-06T10:17:51.510855+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“75.10% mem usage”>>, name: high_system_memory_usage
2023-06-06T10:20:51.519933+08:00 [warning] msg: alarm_is_deactivated, mfa: emqx_alarm:do_actions/3, line: 424, name: high_system_memory_usage
2023-06-06T10:22:51.524427+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“78.14% mem usage”>>, name: high_system_memory_usage
2023-06-06T16:57:00.553616+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“73.30% mem usage”>>, name: high_system_memory_usage
2023-06-06T19:30:01.016113+08:00 [warning] msg: alarm_is_deactivated, mfa: emqx_alarm:do_actions/3, line: 424, name: high_system_memory_usage
2023-06-06T19:32:01.039578+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“77.43% mem usage”>>, name: high_system_memory_usage
2023-06-06T21:18:26.391738+08:00 [warning] msg: authorization_permission_denied, mfa: emqx_authz:authorize_non_superuser/5, line: 362, peername: 167.94.138.127:60868, clientid: CENSYS, topic: #, ipaddr: {167,94,138,127}, source: file, username: undefined
2023-06-07T09:35:33.091123+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“70.63% mem usage”>>, name: high_system_memory_usage
2023-06-07T14:08:34.659511+08:00 [warning] msg: alarm_is_deactivated, mfa: emqx_alarm:do_actions/3, line: 424, name: high_system_memory_usage
2023-06-07T14:09:34.661941+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“71.03% mem usage”>>, name: high_system_memory_usage
2023-06-07T19:58:35.879509+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 8,hint => zero_remaining_len}, offender: [{pid,<0.14865.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:17.300200+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{expected => <<“‘MQTT’ or ‘MQIsdp’”>>,hint => invalid_proto_name,received => <<>>}, offender: [{pid,<0.14878.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:23.103517+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14880.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:28.705914+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{expected => <<“‘MQTT’ or ‘MQIsdp’”>>,hint => invalid_proto_name,received => <<>>}, offender: [{pid,<0.14882.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:43.715330+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14896.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:49.318330+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14898.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T19:59:55.121180+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 6,hint => zero_remaining_len}, offender: [{pid,<0.14900.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:00:24.138953+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_topic,parsed_length => 513,remaining_bytes_length => 10}, offender: [{pid,<0.14910.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:00:45.349930+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14924.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:00:58.957805+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 3,hint => zero_remaining_len}, offender: [{pid,<0.14929.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:01:20.369979+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14935.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:01:33.177398+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14940.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:02:23.404070+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,reason => malformed_utf8_string_length}, offender: [{pid,<0.14964.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:02:40.302860+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,reason => malformed_utf8_string_length}, offender: [{pid,<0.14978.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:02:44.416703+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14979.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:02:50.219568+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.14982.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:03:07.629937+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 3,hint => zero_remaining_len}, offender: [{pid,<0.14988.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:04:19.668058+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 4,hint => zero_remaining_len}, offender: [{pid,<0.15021.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:04:32.275351+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.15025.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:04:45.282744+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.15037.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:04:54.984770+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 9,hint => zero_remaining_len}, offender: [{pid,<0.15042.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:05:05.415240+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.15047.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:05:25.906867+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.15056.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:05:26.113789+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.15057.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:06:20.730867+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,parsed_length => 258,remaining_bytes_length => 1}, offender: [{pid,<0.15079.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T20:06:31.539389+08:00 [warning] msg: authorization_permission_denied, mfa: emqx_authz:authorize_non_superuser/5, line: 362, peername: 47.103.37.203:49066, clientid: nmappfxtboibymptexzr, topic: $SYS/#, ipaddr: {47,103,37,203}, source: file, username: undefined
2023-06-07T20:06:31.540191+08:00 [warning] msg: authorization_permission_denied, mfa: emqx_authz:authorize_non_superuser/5, line: 362, peername: 47.103.37.203:49066, clientid: nmappfxtboibymptexzr, topic: #, ipaddr: {47,103,37,203}, source: file, username: undefined
2023-06-07T20:06:45.124596+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 8,hint => zero_remaining_len}, offender: [{pid,<0.15095.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:31:09.666905+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.16746.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:31:25.117879+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,reason => malformed_utf8_string_length}, offender: [{pid,<0.16750.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:31:40.628955+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 8,hint => zero_remaining_len}, offender: [{pid,<0.16762.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:31:56.122443+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.16767.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:32:11.641373+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.16771.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:32:45.404641+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.16786.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:32:45.852510+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{header_type => 0,hint => zero_remaining_len}, offender: [{pid,<0.16788.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T21:33:01.314549+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2291.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,parsed_length => 256,remaining_bytes_length => 1}, offender: [{pid,<0.16792.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-07T22:16:34.908144+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“72.94% mem usage”>>, name: high_system_memory_usage
2023-06-08T00:38:41.562306+08:00 [warning] msg: authorization_permission_denied, mfa: emqx_authz:authorize_non_superuser/5, line: 362, peername: 183.136.225.32:46789, clientid: nmapNSJKJLFQRGOLJUAE, topic: $SYS/#, ipaddr: {183,136,225,32}, source: file, username: undefined
2023-06-08T00:38:41.563075+08:00 [warning] msg: authorization_permission_denied, mfa: emqx_authz:authorize_non_superuser/5, line: 362, peername: 183.136.225.32:46789, clientid: nmapNSJKJLFQRGOLJUAE, topic: #, ipaddr: {183,136,225,32}, source: file, username: undefined

能提供下完整的 log 文件么,另外就是你的环境信息,比如 CPU 和 内存等数据
然后这段 log 看起来你的 TCP 端口一直在收到 HTTP 信息?

log.zip (3.2 KB)
附件是完整的log文件
服务器用的阿里云的云服务器,2g内存,双核
刚刚启动半个小时又自动停止了
2023-06-08T11:20:33.877222+08:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 418, message: <<“74.90% mem usage”>>, name: high_system_memory_usage
2023-06-08T11:27:59.384679+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2304.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,parsed_length => 769,remaining_bytes_length => 1}, offender: [{pid,<0.2855.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]
2023-06-08T11:31:13.519776+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2304.0>’, errorContext: connection_shutdown, reason: #{hint => invalid_proto_name,parsed_length => 769,remaining_bytes_length => 1}, offender: [{pid,<0.2918.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {tcp,default},zone => default}]}}]

这份日志里面没有太多有用的信息,从日志里面看,你的 MQTT 端口大量收到非 MQTT 协议,建议先排查下这点,是客户端写错了,还是有第三方客户端在连接这些端口。
然后可以的话,你把日志等级设置为 debug,重新生成一份日志看看,也可以检查下系统日志,看看是不是 EMQX 被系统 kill 掉了

log.zip (54.3 KB)
系统日志.zip (1.9 KB)
你好,这是debug日志和系统日志,我使用的系统是centos7,安装的emqx也是centos7的版本,但是系统日志中提到了el8,我按照提示安装了那三个依赖,但系统显示已经安装了,您能帮忙看一下吗

从系统日志看,你的 EMQX 似乎没有启动成功,那你的 EMQX 日志怎么产生的,感觉很奇怪。
CentOS/RHEL | EMQX 5.0 Documentation 你按照这个文档,下载一个 zip 包,使用 ./bin/emqx console 启动下看下