-
Notifications
You must be signed in to change notification settings - Fork 280
Description
Environment
rumqttc version: 0.24.0
tokio version: 1.44.2
OS: Arch Linux 6.14
Broker: Dockerized EMQX
Testing tool: emqx/emqtt-bench
While performance testing my application, I encountered a consistent issue where the client disconnects abruptly under high load. This behavior persists across reboots and is reproducible.
The test involves sending approximately 25,000 messages per second, each 4 bytes in size. The client consistently disconnects almost immediately and returns the following error:
MqttState(Io(Custom { kind: ConnectionAborted, error: "connection closed by peer" }))
in an handler task performing this
loop{
match eventloop.poll.await(){
Ok(event) => /*bla bla*/
Err(conn_err) => /* error returned here, will go right back to eventloop.poll but do nothing forever */
}
}
According to the application's logs, it appears the disconnection is initiated by the server. However, analyzing the EMQX logs indicates a different story:
2025-04-30T09:10:53.137557+00:00 [MQTT] [email protected]:53164 msg: mqtt_packet_received, packet: PUBLISH(Q1, R1, D0, Topic=data/json, PacketId=1487, Payload(text)={"name":"counter","value":"1134","bytes":"AAAAAAAABG4="})
2025-04-30T09:10:53.137625+00:00 [PUBLISH] [email protected]:53164 msg: publish_to, payload_encode: text, topic: data/json, payload: {"name":"counter","value":"1134","bytes":"AAAAAAAABG4="}
2025-04-30T09:10:53.137710+00:00 [MQTT] [email protected]:53164 msg: mqtt_packet_sent, packet: PUBACK(Q0, R0, D0, PacketId=1487, ReasonCode=16)
2025-04-30T09:10:53.342631+00:00 [MQTT] [email protected]:53164 msg: mqtt_packet_received, packet: DISCONNECT(Q0, R0, D0, ReasonCode=0)
2025-04-30T09:10:53.342699+00:00 [SOCKET] [email protected]:53164 msg: socket_force_closed, reason: normal
2025-04-30T09:10:53.342800+00:00 [SOCKET] [email protected]:53164 msg: emqx_connection_terminated, reason: {shutdown,normal}
The client is never explicitly dropped, and no panics are observed.
Even with a significantly increased AsyncClient event loop capacity, the issue persists.
Reproducibility: The disconnection issue can be reproduced consistently on my machine
I am available to provide further details or logs if needed to help diagnose the problem.