Skip to content
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

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

Closed
reubenmiller opened this issue Jul 30, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working theme:mqtt Theme: mqtt and mosquitto related topics
Milestone

Comments

@reubenmiller
Copy link
Contributor

Describe the bug

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

  • check_connection_c8y
  • get_jwt_token_c8y

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):

  • OS [incl. version]: All
  • Hardware [incl. revision]: All
  • System-Architecture [e.g. result of "uname -a"]: All
  • thin-edge.io version [e.g. 0.1.0]: 1.1.2~320+g48a9843

Additional context

@reubenmiller reubenmiller added the bug Something isn't working label Jul 30, 2024
@reubenmiller reubenmiller self-assigned this Jul 30, 2024
@reubenmiller reubenmiller added the theme:mqtt Theme: mqtt and mosquitto related topics label Jul 30, 2024
@reubenmiller reubenmiller added this to the 1.2.0 milestone Jul 30, 2024
@reubenmiller
Copy link
Contributor Author

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

@reubenmiller reubenmiller removed their assignment Jul 31, 2024
@gligorisaev gligorisaev self-assigned this Aug 1, 2024
@gligorisaev
Copy link
Contributor

The bug is not reproducable anymore.
Review done in PR: #3025
Test Case: tests/RobotFramework/tests/tedge_connect/tedge_connect_test.robot

didier-wenzek added a commit to didier-wenzek/thin-edge.io that referenced this issue Jan 28, 2025
This test has been introduced by thin-edge#3024
but is flaky because a similar OpenSSL error occurs but for an unrelated reason.

It the original ticket, the issue was clients failing to disconnect
properly after a successful session. In the flaky case, the client is
not even able to establish an MQTT connection:

```
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: New connection from 127.0.0.1:35138 on port 8883.
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: OpenSSL Error[0]: error:0A000126:SSL routines::unexpected eof while reading
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: Client <unknown> disconnected: Protocol error.
```

To be compared to a client that connects successfully:

```
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: New connection from 127.0.0.1:55188 on port 8883.
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: New client connected from 127.0.0.1:55188 as suftwjdgsw (p2, c1, k60).
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: No will message specified.
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: Sending CONNACK to suftwjdgsw (0, 0)
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: Received SUBSCRIBE from suftwjdgsw
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194:         c8y/s/dat (QoS 1)
```

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
didier-wenzek added a commit to didier-wenzek/thin-edge.io that referenced this issue Jan 28, 2025
This test has been introduced by thin-edge#3024
but is flaky because a similar OpenSSL error occurs but for an unrelated reason.

It the original ticket, the issue was clients failing to disconnect
properly after a successful session. In the flaky case, the client is
not even able to establish an MQTT connection:

```
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: New connection from 127.0.0.1:35138 on port 8883.
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: OpenSSL Error[0]: error:0A000126:SSL routines::unexpected eof while reading
Jan 27 13:06:41 0578accd2d08 mosquitto[787]: 1737983201: Client <unknown> disconnected: Protocol error.
```

To be compared to a client that connects successfully:

```
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: New connection from 127.0.0.1:55188 on port 8883.
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: New client connected from 127.0.0.1:55188 as suftwjdgsw (p2, c1, k60).
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: No will message specified.
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: Sending CONNACK to suftwjdgsw (0, 0)
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194: Received SUBSCRIBE from suftwjdgsw
Jan 28 08:49:54 1bc252b47d05 mosquitto[1305]: 1738054194:         c8y/s/dat (QoS 1)
```

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

No branches or pull requests

2 participants