Azure / azure-event-hubs-c

C client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Other
7 stars 18 forks source link

Error in initialize_uamqp_stack is not propagated #8

Closed alepez closed 7 years ago

alepez commented 7 years ago

See here: https://github.com/Azure/azure-event-hubs-c/blob/84d40943246df1f9fc4a82f8b01a185edf12d6a7/eventhub_client/src/eventhubclient_ll.c#L1732-L1737

When uAMQP stack cannot be initialized (e.g. due to firewall blocking the connection), eventhubclient does not notify users with theon_error_cb callback.

What happen when uAMQP cannot be initialized? The client loops forever, polluting logs with these messages repeated indefinitely:

Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/azure-c-shared-utility/adapters/socketio_berkeley.c Func:socketio_open Line:380 Failure: connect failure 111.
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/azure-c-shared-utility/src/tlsio_openssl.c Func:tlsio_openssl_close Line:1080 Invalid tlsio_state. Expected state is TLSIO_STATE_NOT_OPEN or TLSIO_STATE_CLOSING.
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/azure-c-shared-utility/src/tlsio_openssl.c Func:on_underlying_io_open_complete Line:613 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/eventhub_client/src/eventhubauth.c Func:EventHubAuthCBS_Create Line:769 Could Not Open CBS Handle 153
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/eventhub_client/src/eventhubclient_ll.c Func:create_sas_token Line:367 Couldn't create CBS based Auth Handle
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/eventhub_client/src/eventhubclient_ll.c Func:initialize_uamqp_stack_common Line:585 create_sas_token failed.
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/eventhub_client/src/eventhubclient_ll.c Func:initialize_uamqp_stack Line:696 Could Not Initialize Common AMQP Sender Stack.
Error: Time:Thu Mar 16 16:52:43 2017 File:path_obfuscated/azure-event-hubs-c/eventhub_client/src/eventhubclient_ll.c Func:EventHubClient_LL_DoWork Line:1736 Error initializing uAMPQ sender stack. Code:695 Status:0

Having on_error_cb called when this happen, could let the user handle this exception, e.g. aborting the program.

dcristoloveanu commented 7 years ago

The PR #9 has been merged, thus closing this issue.

Thanks! /Dan