-
Notifications
You must be signed in to change notification settings - Fork 168
Error logged when server closes connection on disconnect #373
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
Comments
Hi @jorispz |
I think you are right about the RST, I made a Wireshark trace of the client connecting and immediately disconnecting, which lead to the following trace:
Would you say this is (apart from the log level) a mistake on the VerneMQ side? |
I am a bit confused about the Edit: ah, wait, that ACK is (re-)acknowledging the earlier |
The RST flag is normally not used when "closing" the connection but only when data is sent on half-open TCP connections, so you should report this to VerneMQ. |
OK, as discussed with the VerneMQ maintainers in the issue linked above, forcefully closing the connection with a RST packet is indeed the default behaviour of VerneMQ by design, although it can be changed by configuration. Personally, I would suggest that the HiveMQ client would, in this specific scenario, swallow the exception and log it on DEBUG if at all, as it is I think not an issue in practice. |
What we will change on the client side: we will ignore all IOExceptions in the MqttDisconnectHandler and change the log level to warn for other types of exceptions (which should never occur). |
We are using the HiveMQ client with the VerneMQ broker, using MQTT5.
Expected behavior
When disconnecting the client by calling
client.disconnect()
, the client disconnects without error.Actual behavior
When disconnecting the client by calling
client.disconnect()
, the following error is always logged:My uneducated guess is that the broker closes the TCP session immediately upon receiving the DISCONNECT message (as it should according to the spec), which leads to the IOException on the client. The code that logs the error is this (
MQTTDisconnectHandler
line 112:However, the state after the call to disconnect() is
CLOSED
, which isn't checked for, but in which case this IOException is probably to be expected and shouldn't be logged? (Especially not on ERROR level).To Reproduce
Connect with a VerneMQ broker over MQTT5, then call
disconnect
on the clientDetails
The text was updated successfully, but these errors were encountered: