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

Fix MQTT plugin (#1006, #1008) #1009

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Valle125
Copy link

@Valle125 Valle125 commented Sep 21, 2024

This pull request fixes issues #1006 and #1008.

On Linux the MQTT plugin freezes PlotJugger see issue #1008. The program flow seems to be stuck within mosquitto_connect_bind_v5() on the second connection attempt. This is solved by starting with a fresh mosquitto instance at each connection attempt.

On Windows PlotJuggler doesn't show any topics after establishing a connection, see issue #1006. mqtt_client.cpp does not check the return code of mosquitto_loop_start(), which may return MOSQ_ERR_NOT_SUPPORTED on Windows. This causes the plugin to assume that the connection has been established, but in reality the mosquitto event loop is not processed. This causes the user to think that a connection was established but no topics are displayed. The plugin worked in the past with no recent changes to the source code, so what causes the problem? It seems that libmosquitto has at some point dropped threaded support on Windows (see eclipse/mosquitto#2707). Threaded support will be added again in the future (maybe 2.1?). To solve this problem mosquitto gets it's own thread if mosquitto_loop_start() fails.

To make mqtt_client.cpp more robust all mosquitto_xxx return codes are checked. To increase the user experience some QMessageBox messages have been added.

fixes #1006
fixes #1008

Kind regards,
Valentin

Valle125 and others added 4 commits September 19, 2024 22:34
…itto_connect_bind_v5.

The connection procedure starts with a fresh mosquitto instance each time. The instance will be destroyed on disconnect.
All mosquitto return codes are now checked during client configuration.
Threaded mode of libmosquitto may not be supported on windows (libmosquitto < 2.1). At some point libmosquitto has removed threaded support (mosquitto_loop_start doesn't work and returns MOSQ_ERR_NOT_SUPPORTED). Threaded support will be added again in the future, see eclipse/mosquitto#2707. This commit introduces a thread dedicated to mosquitto to solve the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MQTT plugin freezes PlotJuggler on Linux. MQTT subscriber 3.9.0 windows does not show any topics at all.
1 participant