-
Notifications
You must be signed in to change notification settings - Fork 340
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
Client triggering disconnected signal only after recovering connection #187
Comments
From my point of view |
What class does |
The socket errors are forwarded to the |
I have the same problem, the error signal doesn't get triggered until I recover connection. So when the client recovers connection it trigger both signals: |
Okay, so let us ask someone else: @ejvr, @KonstantinRitt any idea what the reason could be? @SirHeisenberg Have you tried also with a different client OS? Not that this issue is pertinent to the underlying socket API? |
@mwallnoefer I tried it in a Raspberry Pi and in a machine with Ubuntu, both have the same issue |
Yes, but these are both Linux and hence will behave similarly. Here it would be interesting to reproduce on an alternative system like MacOSX, iOS, Android or also Windows since this could perfectly be a bug in Qt (= a misinterpretation of the OS' socket API semantics). |
It seems to be a Linux specific thing. To test this I modified the example application to log disconnect and error signals, and enabled the auto reconnect. On windows 10 you see an error and a disconnect message in less than one second after disconnect (I pulled out my network cable from the client system to force disconnection). Trying the same thing on my Linux system (a beaglebone block running debian v9) gives the same result @SirHeisenberg reports: there is no error message and no disconnect. However, when I plugged the network cable in again, the example program simply continued receiving data on its subscriptions. So it seems the socket has never been closed at all. I also noticed that my SSH session to the beaglebone was not closed either, and I could use it again after plugging in the cable. So, to me this seems to be some kind of Linux oddity. I'm not sure if we have to fix this (can we fix this?) in QMQTT. |
Thanks for the reproduction, @ejvr. So yes this seems to be a Qt - GNU/Linux-specific issue, look at: Also interesting (more to Windows): Maybe Qt 6 will handle this better? |
Hmm, the fact that my SSH session was not disconnected either when the network cable is unplugged suggests that this is not a QT issue, but a Linux 'feature'. We could check what happens if the network connection is closed in software (eg. using ifdown). I guess that the operating system will immediately close any related sockets. |
Hello!
I'd like to report what I think it's a bug. Maybe it's because I'm missing something though.
When my client loses connection itself (client loses connection within the network) it doesn't trigger the
disconnected()
signal until it recovers connection again.If it's the broker the one who loses connection the client triggers the
disconnected()
signal instantly, but as I mentioned before, if the client is the one who loses connection the signal isn't triggered until it recovers connection.I don't know if there is another option to know if the client has connection apart of
pingresp
, which only lets me know when I have connection but not when I lose it.Thanks.
The text was updated successfully, but these errors were encountered: