Comments (9)
Yeah this used to be the case, but I changed it for simplicity (and forgot to update the docs)
https://github.com/bytebeamio/rumqtt/blob/master/rumqttc/src/eventloop.rs#L201-L202
Is this an issue in your case?
from rumqtt.
I only detected it because, for some reason (perhaps broker stress due to amount of requests), I received an error on eventloop because of it.
[2020-07-28T00:39:09Z ERROR rumqttc::state] Error awaiting for last ping response
[2020-07-28T00:39:09Z ERROR dt_client] MqttState(AwaitPingResp)
This caused disconnection, which lead to subscriber missing messages. I still need to refactor my subscriber to use rumqttc and not rumq-client, but the pinging behaviour happened on both. My publisher has already changed to rumqttc, and I used the matching behaviour I described above so the application doesn't crash on unwrapping the error message.
But thanks for the answer on the keep_alive. I'll just ping it less frequently.
For the issue itself, I believe just updating the documentation is more apropriate.
For the other point, i'm not sure how ping requests and responses work in MQTT to suggest an alternative. I'll see if refactoring on the subscriber to ignore this error is enough to not lose these messages.
from rumqtt.
That error is important. You shouldn't ignore that error. It detects half-open connections.
from rumqtt.
How would I handle these errors?
The examples only unwrap on the eventloop, so the application immediately crashes.
from rumqtt.
Sorry I mean the library shouldn't ignore these errors. Let me check if I understood your question correctly.
- Your broker (for some reason) is not sending ping responses
- You want the client to not get disconnected when this happens?
from rumqtt.
* Your broker (for some reason) is not sending ping responses
Yes, not consistently, just occasionally. I haven't been able to debug the reason behind it.
* You want the client to not get disconnected when this happens?
Yes, because until the subscriber program subscribes again, the broker discards a good amount of messages sent.
I believe this could be mitigated with retention and QoS changes, but it would depend on the broker implementation, not the client.
For the client itself, I believe that closing the connection on ping errors is not the ideal way of handling messages, if connection is still working, but failed for one ping.
from rumqtt.
Yes, because until the subscriber program subscribes again, the broker discards a good amount of messages sent.
I believe this could be mitigated with retention and QoS changes, but it would depend on the broker implementation, not the client.
Is there a reason you are not using persistent session? Most (reasonable) brokers will have offline peristence when clean session = false
For the client itself, I believe that closing the connection on ping errors is not the ideal way of handling messages, if connection is still working, but failed for one ping
Unfortunately, that's not possible. That one ping failing detects half-open connections as soon as possible and reconnects
from rumqtt.
Is there a reason you are not using persistent session? Most (reasonable) brokers will have offline peristence when
clean session = false
It's just not using message retention by default. Haven't tested with the configuration enabled yet.
I'll update if it's enough to not lose messages due to this disconnection.
from rumqtt.
Closed because it indeed helped.
Other source of lost packets was reaching max queue size on the broker. Setting a larger queue made lost packet count reach zero, but of course this depends on each implementation scenario, since queue sizes are needed due to broker not having infinite memory.
from rumqtt.
Related Issues (20)
- Password authentication is not constant-time HOT 5
- rumqttd: external auth should be async
- An Error = MqttState(AwaitPingResp) error occurred when creating a connection using rumqttc v5 HOT 3
- RFC(rumqttc): `publish` / `subscribe` / `unsubscribe` methods return a promise that resolves into pkid when packet is handled by `Eventloop` HOT 18
- [rumqttc] - Using websocket feature makes EventLoop not Send / can't be spawned with tokio::spawn HOT 4
- [rumqttc] MqttOptions::parse_url broken for websocket urls HOT 1
- [rumqttd] v0.19 not published to docker hub HOT 2
- rumqttc: Outgoing publications are sent one by one HOT 11
- rumqttc: Throttling of pending requests can cause starvation on the request side HOT 6
- rumqttc: `ConnectionError::RequestsDone` is unreachable HOT 3
- rumqttc: value returned by `v4::Connect.write` doesn't match reality HOT 4
- Non-blocking receive never notifies HOT 3
- rumqttc panics if network connection is closed by broker
- rumqttc: getting incorrect unsolicited acks error logs
- macOS ci is broken HOT 2
- rumqttc - AUTH packet support HOT 13
- rumqttc - ack with reason code HOT 3
- rumqttc: Could publish/subscribe methods directly return the msg id? HOT 2
- Does `MqttOptions` `request_channel_capacity` field do anything? HOT 3
- Keep the ACK ordering when using manual ACK HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rumqtt.