Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.58k stars 2.8k forks source link

[Event Hubs] Indefinite Wait After Rotating Primary Key While Receiving Events #33926

Closed g1t-out closed 2 months ago

g1t-out commented 9 months ago

Describe the bug When receiving data from the event hub, if the primary key is rotated, the program will wait indefinitely receiving no data. It never throws an exception or attempts are reconnect (After leaving it wait for 30+ minutes).

To Reproduce Steps to reproduce the behavior:

  1. Receive data on an event hub
  2. Rotate the Primary Key in Azure for the EventHub

Expected behavior The SDK should detect that it is no longer connected and receiving data from the EventHub. An exception should be eventually thrown.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I've been working around this for now by passing a max_wait_time of 30 seconds to the receive_batch function. I keep track of the number of sequential callbacks without event data and will eventually throw an exception, but it would be cleaner to handle it in the SDK.

kashifkhan commented 9 months ago

Thank you for the feedback @g1t-out. How exactly are you rotating the primary key ?

github-actions[bot] commented 9 months ago

Hi @g1t-out. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

g1t-out commented 9 months ago

Thank you for the feedback @g1t-out. How exactly are you rotating the primary key ?

I do it through the Azure Portal. Open Event Hubs, then click on the Event Hub Namespace, then click on the Event Hub, then click "Shared access policies", then click "Regenerate Primary Key".

image

kashifkhan commented 8 months ago

Thanks @g1t-out . Im able to reproduce this error and will update this thread once I have a fix out.