thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

tedge connect c8y does not cleanly close the local MQTT connection #3024

Closed reubenmiller closed 2 months ago

reubenmiller commented 2 months ago

Describe the bug

The following MQTT client instances do not send an MQTT DISCONNECT to official close the connection.

Below are the mosquitto log entries showing the abrupt disconnects (which seem to be visible via the OpenSSL Error message):

client id: check_connection_c8y

Jul 30 07:09:10 fc0518bf190f mosquitto[418]: 1722323350: OpenSSL Error[0]: error:0A000126:SSL routines::unexpected eof while reading
Jul 30 07:09:10 fc0518bf190f mosquitto[418]: 1722323350: Client check_connection_c8y closed its connection.

client id: get_jwt_token_c8y

Jul 30 07:33:55 7cf39fd378c8 mosquitto[418]: 1722324835: OpenSSL Error[0]: error:0A000126:SSL routines::unexpected eof while reading
Jul 30 07:33:55 7cf39fd378c8 mosquitto[418]: 1722324835: Client get_jwt_token_c8y closed its connection.

To Reproduce

When using TLS settings on the local MQTT mosquitto broker, the following commands seem to be enough to invoke the error:

tedge connect c8y
tedge connect c8y --test

The following ticket is a similar ticket which has already been solved but was another instance of an MQTT client not closing the connection cleanly:

Expected behavior

In normal operation, an MQTT client should close the MQTT connection cleanly by sending a DISCONNECT packet to the broker.

Screenshots

Environment (please complete the following information):

Additional context

reubenmiller commented 2 months ago

The linked PR includes a system test: Check absence of OpenSSL Error messages #3024

gligorisaev commented 2 months ago

The bug is not reproducable anymore. Review done in PR: https://github.com/thin-edge/thin-edge.io/pull/3025 Test Case: tests/RobotFramework/tests/tedge_connect/tedge_connect_test.robot