Azure / azure-uamqp-python

AMQP 1.0 client library for Python
MIT License
56 stars 48 forks source link

Reappear - eventhub: the program crashes if producer not use with #253

Closed adss-poc closed 1 year ago

adss-poc commented 3 years ago

eventhub: the program crashes if producer not use with with We are using version uampq library v1.2.15 (python v3.9.2) and we are still having the same issue I saw in the below link it was fixed as part of uampq library v1.2.5

https://github.com/Azure/azure-sdk-for-python/issues/8404

Please check the below error trace of the crash. 2021-06-29 06:37:06,222 :: INFO :: push_event :: 93 :: Create a batch. 2021-06-29 06:37:06,224 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.START: 0> to <ConnectionState.START: 0> 2021-06-29 06:37:06,638 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.START: 0> to <ConnectionState.START: 0> 2021-06-29 06:37:06,863 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.START: 0> to <ConnectionState.HDR_SENT: 2> 2021-06-29 06:37:06,914 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.HDR_SENT: 2> to <ConnectionState.HDR_EXCH: 3> 2021-06-29 06:37:06,914 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.HDR_EXCH: 3> to <ConnectionState.OPEN_SENT: 7> 2021-06-29 06:37:06,964 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' state changed from <ConnectionState.OPEN_SENT: 7> to <ConnectionState.OPENED: 9> 2021-06-29 06:37:07,065 :: INFO :: work :: 259 :: CBS for connection b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' completed opening with status: 1 2021-06-29 06:37:07,115 :: INFO :: work :: 259 :: Token put complete with result: 1, status: 202, description: b'Accepted', connection: b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' 2021-06-29 06:37:07,166 :: INFO :: on_state_changed :: 268 :: Message sender b'sender-link-10c4757a-0993-4e58-af7b-1ff19d51b29e' state changed from <MessageSenderState.Idle: 1> to <MessageSenderState.Opening: 2> on connection: b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' 2021-06-29 06:37:07,217 :: INFO :: on_state_changed :: 268 :: Message sender b'sender-link-10c4757a-0993-4e58-af7b-1ff19d51b29e' state changed from <MessageSenderState.Opening: 2> to <MessageSenderState.Open: 3> on connection: b'EHProducer-0887f0ab-547f-4362-9360-11b12af5cfbe' 2021-06-29 06:37:07,268 :: INFO :: push_event :: 96 :: Add events to the batch. 2021-06-29 06:37:07,268 :: INFO :: push_event :: 99 :: Send the batch of events to the event hub. 2021-06-29 06:37:07,268 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'Failure: sending socket failed 10054.' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\socketio_win32.c':b'socketio_send':580) 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'send_chunk':548) 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'send_chunk failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'internal_send':589) 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'tlsio_schannel_send':1336) 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1190) 2021-06-29 06:37:07,269 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,269 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-21eb7852-5c42-43f9-b34e-56c874ff8dfa' state changed from <ConnectionState.OPENED: 9> to <ConnectionState.END: 13> 2021-06-29 06:37:07,270 :: INFO :: _state_changed :: 180 :: Connection with ID b'EHProducer-21eb7852-5c42-43f9-b34e-56c874ff8dfa' unexpectedly in an error state. Closing: False, Error: None 2021-06-29 06:37:07,270 :: INFO :: init :: 74 :: CBS error occurred on connection b'EHProducer-21eb7852-5c42-43f9-b34e-56c874ff8dfa'. 2021-06-29 06:37:07,270 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,270 :: INFO :: init :: 74 :: b'send called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1181) 2021-06-29 06:37:07,270 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,270 :: INFO :: init :: 74 :: b'saslclientio_close called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_close_async':1130) 2021-06-29 06:37:07,270 :: INFO :: init :: 74 :: b'xio_close failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':272) 2021-06-29 06:37:07,270 :: WARNING :: init :: 74 :: Can't call on_connection_state_changed during garbage collection 2021-06-29 06:37:07,271 :: WARNING :: init :: 74 :: Can't call on_connection_state_changed during garbage collection 2021-06-29 06:37:07,271 :: INFO :: init :: 74 :: b'saslclientio_close called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_close_async':1130) 2021-06-29 06:37:07,271 :: INFO :: init :: 74 :: b'xio_close failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'connection_close':1437) 2021-06-29 06:37:07,271 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,271 :: INFO :: init :: 74 :: b'Failure: sending socket failed 10054.' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\socketio_win32.c':b'socketio_send':580) 2021-06-29 06:37:07,271 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'send_chunk':548) 2021-06-29 06:37:07,271 :: INFO :: init :: 74 :: b'send_chunk failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'internal_send':589) 2021-06-29 06:37:07,272 :: INFO :: init :: 74 :: b'send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'tlsio_schannel_send':1336) 2021-06-29 06:37:07,272 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1190) 2021-06-29 06:37:07,272 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,272 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-27e50c51-e45f-4f93-a9ba-6c085269b22e' state changed from <ConnectionState.OPENED: 9> to <ConnectionState.END: 13> 2021-06-29 06:37:07,272 :: INFO :: _state_changed :: 180 :: Connection with ID b'EHProducer-27e50c51-e45f-4f93-a9ba-6c085269b22e' unexpectedly in an error state. Closing: False, Error: None 2021-06-29 06:37:07,272 :: INFO :: init :: 74 :: CBS error occurred on connection b'EHProducer-27e50c51-e45f-4f93-a9ba-6c085269b22e'. 2021-06-29 06:37:07,272 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'send called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1181) 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'saslclientio_close called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_close_async':1130) 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'xio_close failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':272) 2021-06-29 06:37:07,273 :: WARNING :: init :: 74 :: Can't call on_connection_state_changed during garbage collection 2021-06-29 06:37:07,273 :: WARNING :: init :: 74 :: Can't call on_connection_state_changed during garbage collection 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'saslclientio_close called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_close_async':1130) 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'xio_close failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'connection_close':1437) 2021-06-29 06:37:07,273 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,273 :: INFO :: init :: 74 :: b'Failure: sending socket failed 10054.' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\socketio_win32.c':b'socketio_send':580) 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'send_chunk':548) 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: b'send_chunk failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'internal_send':589) 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: b'send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\deps\azure-c-shared-utility\adapters\tlsio_schannel.c':b'tlsio_schannel_send':1336) 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: b'xio_send failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1190) 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,274 :: INFO :: _state_changed :: 177 :: Connection b'EHProducer-87357cd3-6d78-48ca-842b-81f63518df78' state changed from <ConnectionState.OPENED: 9> to <ConnectionState.END: 13> 2021-06-29 06:37:07,274 :: INFO :: _state_changed :: 180 :: Connection with ID b'EHProducer-87357cd3-6d78-48ca-842b-81f63518df78' unexpectedly in an error state. Closing: False, Error: None 2021-06-29 06:37:07,274 :: INFO :: init :: 74 :: CBS error occurred on connection b'EHProducer-87357cd3-6d78-48ca-842b-81f63518df78'. 2021-06-29 06:37:07,275 :: WARNING :: init :: 74 :: Can't call on_state_changed during garbage collection, please be sure to close or use a context manager 2021-06-29 06:37:07,275 :: INFO :: init :: 74 :: b'send called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_send_async':1181) 2021-06-29 06:37:07,275 :: INFO :: init :: 74 :: b'Cannot send encoded bytes' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':268) 2021-06-29 06:37:07,275 :: INFO :: init :: 74 :: b'saslclientio_close called while not open' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\saslclientio.c':b'saslclientio_close_async':1130) 2021-06-29 06:37:07,275 :: INFO :: init :: 74 :: b'xio_close failed' (b'D:\a\1\s\src\vendor\azure-uamqp-c\src\connection.c':b'on_bytes_encoded':272)

PROGRAM CRASHED without giving any exception.

yunhaoling commented 3 years ago

hey @adss-poc , sorry for missing the thread here. Could you share me with the code snippets which could reproduce the issue?

yunhaoling commented 2 years ago

hey @adss-poc , hope you are keeping well!

I'm excited to announce that we redesigned our Python EventHubs SDK to not rely on any C code anymore, it’s now entirely implemented in Python (5.8.0a3 - pypi). We’d love to get your feedback and perspective on this new version, as we believe you are using this SDK in an environment that would benefit from the changes.

Here are some highlights of the SDK : • Stability and robustness, eliminating any risks of C related memory leak or segmentation fault errors. • Full multi-platform support (ARM processors like M1, etc.) • Improved sending and receiving performance.

To get started, just install the wheel by command pip install azure-eventhub==5.8.0a3 in your Python environment and you're all set to go with your applications. This package is fully backward compatible, and no changes are needed in your application.

We’re eager to hear what you think. Please reply to this thread at any time with feedback or any questions you have for us! We’re all ears.

kashifkhan commented 1 year ago

We now have released the latest azure-eventhub that is using the new python based amqp library. It would be great if you can give that a try. If there are issues with the client library please open an issue on the sdk repo