-
Notifications
You must be signed in to change notification settings - Fork 52
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
Connection lost on Linux server #103
Comments
@dgambin could you please set debug-level logging? |
From both broker and client sides it looks like socket was closed unexpectedly :( I guess more research on system and network settings is needed |
I see the same or similar issue - in my case a connection to a mostly default (apart from logging) configured localhost Ubuntu mosquitto broker has timeout disconnects resulting in missed messages. It looks to me (logs below) like the gmqtt client sends PINGREQ messages every (default) 60 seconds, which maintains the connection to the mosquitto broker fine. But when the subscription receives a message it then (usually, I think) stops sending the PINGREQs, the mosquitto broker drops the client (by closing the socket) after 1.5 x the keepalive period, the gmqtt client immediately wakes up on the disconnect and reconnects and resubscribes (taking ~5 seconds to reconnect and missing any messages during that period). When the gmqtt client reconnects, it starts sending PINGREQs again. In this non-PINGREQ period the gmqtt client subscription continues to work fine, i.e. I can publish more messages and they will all be received. But the mqtt client will still be kicked off the mosquitto broker after 1.5 x the keepalive and have to reconnect. Reproducible with the 'simple example' subscriber program given on the homepage README of this repo. I modified this provided gmqtt example simply to include timestamps and to connect to my default localhost mosquitto broker in my github here. I published simple test messages on topic TEST/user about every 10 seconds using I ran
The example program subscribes to
The example program output above shows it missing the 1585751861 message. The mosquitto broker drops the GMQTT client at 1585751859, as shown in the
Another run with logging set to debug, this time with keepalive=20:
For which the mosquitto broker log (last PING at 1585757100, dropped at 1585757129 :
|
Hi @ijl20, thanks for your investigation, it will help us to understand and find out where is the mistake. |
On further debugging the issue seems to be that I modified
I think using Thanks for the effort supporting this - IMHO gmqtt is a nice product which sensibly aims at providing just the client well rather than client+broker. |
Quick heads up... on further testing with patch #105 I think there remains a similar timeout issue for a client publisher. (I haven't properly debugged yet, just wanted to post quickly) I modified my earlier
Although the regular publishes succeed, the responses from
From a simple
|
Fix looks good to me (I cloned master from Lenka42/gmqtt), and my pub & sub test code all behaves fine now. I hadn't considered the significance of frequent + qos=0 publishes being the special case in my 'publisher' issue but see exactly what you mean. |
@dgambin Could you please check the newest version |
I have just tried and for now I don't see any problem :-) |
Hi,
I am getting connect/disconnect events all the time on my Linux (debian) server. The same script works ok on my local machine (mac). The pattern is always the same, like:
CONNECTED->SUBSCRIBED->CONN CLOSE NORMALLY/DISONNECT after exactly 4 minutes->CONNECTED->CONN CLOSE NORMALLY/DISONNECT after exactly 2 minutes. Then it repeats every 2 minutes many times, then again 4 minutes/2 minutes.
I don't find anything in my server logs and there is only "503: mqtt session connection was closed (Unexpected disconnect)" message logged on flespi platform.
Any clue on what this could be? Probably some server/network related stuff but don't know how to identify it
I am attaching the screenshot from my terminal.
Thx on any help that could help me resolve this.
regards, dejan
The text was updated successfully, but these errors were encountered: