CModule fails on my CentOS device with opennssl error
purvit opened this issue · 2 comments
I followed the steps in this article: https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-c-module?view=iotedge-2020-11
to deploy a CModule on my Azure IoT Edge Transparent gateway using certificates to communicate with downstream devices.
This issue is linked with this...Azure/iotedge#5343
As I ran through multiple steps of building a transparent gateway and making it work with downstream devices. However, the CModule is unable to process telemetry data coming from downstream devices - after configuring appropriate routes in Azure IoT Hub and changing the parsing logic to take data from various telemetry stream fields.
I have made this work with Ubuntu as per MS articles, however with my solution and CentOS product it fails. Can you help resolve this ASAP? The logs are in the issue: Azure/iotedge#5343
Adding logs again...
void iothub_module()
{
IOTHUB_MODULE_CLIENT_LL_HANDLE iotHubModuleClientHandle;
srand((unsigned int)time(NULL));
if ((iotHubModuleClientHandle = InitializeConnection()) != NULL && SetupCallbacksForModule(iotHubModuleClientHandle) == 0)
{
// The receiver just loops constantly waiting for messages.
printf("Waiting for incoming messages.\r\n");
while (true)
{
printf("Purvi: Before Calling IoTHubClient_DoWork.\r\n");
IoTHubModuleClient_LL_DoWork(iotHubModuleClientHandle);
printf("Purvi: After Calling IoTHubClient_DoWork.\r\n");
ThreadAPI_Sleep(100);
}
}
DeInitializeConnection(iotHubModuleClientHandle);
}
int main(void)
{
printf("Purvi: main Module Invoked.\r\n");
iothub_module();
return 0;
}
Tracing is as follows:
Purvi: main Module Invoked.
Waiting for incoming messages.
Purvi: Before Calling IoTHubClient_DoWork.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:479 failure in X509_STORE_add_cert
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:486 [0] error:0B07C065:x509 certificate routines:X509_STORE_add_cert:cert already in hash table
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:479 unable to add_certificate_to_store.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1419 Failed creating the OpenSSL instance.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-umqtt-c-0A9eNL/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:mqtt_client_connect Line:1093 Error: io_open failed
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-iot-sdk-c-0HSwYl/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2521 failure connecting to address vm1.ceek-7cqcpenlzuuhg.westus2.cloudapp.azure.com.
Purvi: After Calling IoTHubClient_DoWork.
Purvi: Before Calling IoTHubClient_DoWork.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:479 failure in X509_STORE_add_cert
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:486 [0] error:0B07C065:x509 certificate routines:X509_STORE_add_cert:cert already in hash table
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:479 unable to add_certificate_to_store.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-c-shared-util-51hOXC/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1419 Failed creating the OpenSSL instance.
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-umqtt-c-0A9eNL/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:mqtt_client_connect Line:1093 Error: io_open failed
Error: Time:Sat Aug 21 03:12:34 2021 File:/build/azure-iot-sdk-c-0HSwYl/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2521 failure connecting to address vm1.ceek-7cqcpenlzuuhg.westus2.cloudapp.azure.com.
Purvi: After Calling IoTHubClient_DoWork.
Purvi: Before Calling IoTHubClient_DoWork.
Purvi: After Calling IoTHubClient_DoWork.
Purvi: Before Calling IoTHubClient_DoWork.
Purvi: After Calling IoTHubClient_DoWork.
Purvi: Before Calling IoTHubClient_DoWork.
Purvi: After Calling IoTHubClient_DoWork.
As far as I can tell this is not a problem with parson and you should look for a solution somewhere else.