-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Mosquitto connectivity over 3g #1133
Comments
Could you provide some example code of what you are trying to do, plus what version you are working with? |
The version we are working with is 1.5.5 on OpenWrt (k4.1.23) built with GCC(5.3.0), musl(1.1.14). MQTT works in single-threaded regime. It's a event-driven state machine which has separate states of:
MqttPublish event is dependent on iConnected flag so there is no mosquitto_publish() call when this flag is set to false. Reconnect mechanism is also available, tested and working fine with more reliable connectivity. Also - iConnected flag is dependent on response (or it's ) for PINGREQ, and CONNECT messages (respectively: PINGRESP, CONNACK). As I have mentioned before the connectivity medium is a poor quality 3g network. Also there is this problem with sockets in CLOSE_WAIT state. Our TCP keepalive is set to 120 sek. but it looks like it's not relevant at all. For managing iConnected flag we use native reconnection mechanism. Also - to provide most reliable information about connection we use mosquitto_log_callback_set to monitor if PINGRESP is provided within keepalive time interval AND callbacks for connect and disconnect. Hope my description is sufficient - If not - I believe I can provide with more details. |
Sorry, that doesn't really give me anything to go on. I'm not even sure whether you're saying that the built in libmosquitto reconnection code isn't working, or whether you are implementing your own :) |
Heh 😄. That is a problem 😉. Reconnection mechanism we use is the one built in libmosquitto. For connection validation (iConnected flag) we use message string provided for log callback (mosquitto_log_callback_set()). |
Ok, that sounds odd. Why not use the on_connect callback? |
We do use it. They also manage the iConnected flag. |
I've updated my initial description. Has anyone experienced anything like that? |
For me there isn't enough detail about what you're doing to be able to make any more comments I'm afraid. The devil is likely to be in the detail of what you are doing. |
We are experiencing an issue:
We have a device connecting with MQTT broker over 3g (with poor signal quality).
We are experiencing some kind of deadlock in reconnect mechanism and having a bunch of sockets in CLOSE_WAIT stage with RecvQ of 3642. The number of sockets in CLOSE_WAIT state seems to increase with decreasing the keepalive parameter.
Disconnect callback finally results with rc =1 (NOMEM).
Did anyone, ever experienced such thing?
The text was updated successfully, but these errors were encountered: