You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with version 2.0.18 cross compiling for ARM (Raspberry Pi).
I want to run a detached thread with any of mosquitto_loop... APIs (to be able to execute other application threads), but I am not able to get it working, only when it is called from the main thread.
I have created a class with a Start method which initialize required fields from mosq_config struct and call all mosquitto APIs to configure TLS and callbacks.
Then, if I call mosquitto_connect_bind_v5 and then mosquitto_loop_forever (inside Start method), this connects and subscribe to broker correctly.
But if I move those two functions to a detached thread run from Start method, mosquitto_connect_bind_v5 fails (sometimes) with "Bad file descriptor" or most of the time with "A TLS error occurred".
Debugging this I get:
4063442928 [ERROR] [MosquittoClient::LogCallback] Error: Unable to load CA certificates, check cafile "▒3▒▒".
4063442929 [ERROR] [MosquittoClient::LogCallback] OpenSSL Error[0]: error:02001002:system library:fopen:No such file or directory
4063442929 [ERROR] [MosquittoClient::LogCallback] OpenSSL Error[1]: error:2006D080:BIO routines:BIO_new_file:no such file
4063442930 [ERROR] [MosquittoClient::LogCallback] OpenSSL Error[2]: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
Which means that mqttClient->tls_cafile lost its content after the thread creation and because of that the connection is never established.
Attached there is a reduced sample of the class I have created.
Hi,
I am working with version 2.0.18 cross compiling for ARM (Raspberry Pi).
I want to run a detached thread with any of mosquitto_loop... APIs (to be able to execute other application threads), but I am not able to get it working, only when it is called from the main thread.
I have created a class with a Start method which initialize required fields from mosq_config struct and call all mosquitto APIs to configure TLS and callbacks.
Then, if I call mosquitto_connect_bind_v5 and then mosquitto_loop_forever (inside Start method), this connects and subscribe to broker correctly.
But if I move those two functions to a detached thread run from Start method, mosquitto_connect_bind_v5 fails (sometimes) with "Bad file descriptor" or most of the time with "A TLS error occurred".
Debugging this I get:
Which means that mqttClient->tls_cafile lost its content after the thread creation and because of that the connection is never established.
Attached there is a reduced sample of the class I have created.
MosquittoClient.log
The text was updated successfully, but these errors were encountered: