Open reubenmiller opened 3 weeks ago
Looking at the core/tedge/src/cli/mqtt/publish.rs, it looks like disconnect is being called, however the message is not actually sent (possibly because the event loop is not running as the .iter()
has already finished).
Tested with:
1.1.1-113-g82732a9e21
bug is not reproducable.
Created test in the PR: https://github.com/thin-edge/thin-edge.io/pull/2944
Describe the bug
When the local mosquitto MQTT broker instance is configured to use certificates, then publishing an MQTT message via
tedge mqtt pub
, anOpenSSL
log error is visible in the mosquitto logs (related to the publishing of the message), below shows an example of this error:Publishing the same message with mosquitto_sub does not result in an OpenSSL error (see the "additional context" section for an example).
The logs related to the entire MQTT publish call is shown below (including the OpenSSL error).
Most likely the MQTT connection is not being correctly stopped, and instead just being abruptly terminated without sending an MQTT disconnect message.
The main motivation to addressing this issue is to reduce the "noise" in the logs, otherwise the user thinks there is something wrong, and it can mask other issues.
To Reproduce
This assumes that you have configured mosquitto to write its logs to journald, however you can of course use You can also use the file based logging option for mosquitto,
Configure the mosquitto instance to use certificates
For example if you have set everything up correctly, then your
tedge config list
should look something like this (exact paths might be different though, depending on how you set it up)Publish any message
Inspect the mosquitto logs
If you've configured mosquitto to log to syslog/journald, then check the output
Expected behavior
The tedge mqtt broker should cleanly disconnect from the local MQTT broker by sending a
DISCONNECT
message.For example the following commands should send
tedge mqtt pub
- a DISCONNECT message should be sent after publishing the messagetedge mqtt sub
- a DISCONNECT message should be sent when the process is exiting (e.g. a signal handler will have to be used to gracefully disconnect on SIGINT, SIGQUIT, SIGTERM etc.)Screenshots
Environment (please complete the following information):
Debian GNU/Linux 12 (bookworm)
unknown
Linux fe9669c87b15 6.5.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 27 00:18:38 UTC 2024 aarch64 GNU/Linux
tedge 1.1.2~65+g81eb5d0
Additional context
mosquitto_pub example
Publishing the same MQTT message using mosquitto_sub does not result in any OpenSSL error.