Skip to content

rumqttc: Sudden Disconnection During High-Load #963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JacopoWolf opened this issue Apr 30, 2025 · 0 comments
Open

rumqttc: Sudden Disconnection During High-Load #963

JacopoWolf opened this issue Apr 30, 2025 · 0 comments

Comments

@JacopoWolf
Copy link

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] myapp.client@172.18.0.1: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] myapp.client@172.18.0.1: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] myapp.client@172.18.0.1:53164 msg: mqtt_packet_sent, packet: PUBACK(Q0, R0, D0, PacketId=1487, ReasonCode=16)
2025-04-30T09:10:53.342631+00:00 [MQTT] myapp.client@172.18.0.1:53164 msg: mqtt_packet_received, packet: DISCONNECT(Q0, R0, D0, ReasonCode=0)
2025-04-30T09:10:53.342699+00:00 [SOCKET] myapp.client@172.18.0.1:53164 msg: socket_force_closed, reason: normal
2025-04-30T09:10:53.342800+00:00 [SOCKET] myapp.client@172.18.0.1: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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant