Skip to content

[EventHub] Raise error when primary key is rotated#36245

Merged
swathipil merged 11 commits intoAzure:mainfrom
swathipil:swathipil/eh/rotate-primary-key-bug
Aug 5, 2024
Merged

[EventHub] Raise error when primary key is rotated#36245
swathipil merged 11 commits intoAzure:mainfrom
swathipil:swathipil/eh/rotate-primary-key-bug

Conversation

@swathipil
Copy link
Member

@swathipil swathipil commented Jun 25, 2024

fixes: #33926

Currently, when the primary key is rotated while receiving from an Event Hub, it results in an auth-failed error from the service when updating/putting token. However, this auth-failed error is not raised to the user.

Changes:

  • Raising without retrying on AuthenticationException.

More context: It gets caught internally in the exception, but on the next retry, it does not get raised on the re-opening of the ReceiveClient. This is b/c the [if client_ready check] allows the _open method to return even when client is not ready (i.e. False). When while is used, for example when auth-failed occurs during a management request, the client_ready waits for either True or an error to be raised. Because of client ready not waiting in the receive, the receive loops forever in the case of an auth-failed exception.

Investigated:

  • Changing the if to a while in the consumer._open client_ready check. However, this caused about 100% drop in receive perf.
  • Raising right away without retrying on AuthenticationException, as those should not be recoverable without user intervention. This works.

@swathipil swathipil changed the title [EventHub] Raise error primary key is rotated [EventHub] Raise error when primary key is rotated Jun 25, 2024
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil swathipil marked this pull request as ready for review August 2, 2024 18:01
@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

/azp run python - eventhub - ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil swathipil enabled auto-merge (squash) August 5, 2024 22:01
@swathipil swathipil merged commit 3b2dfa4 into Azure:main Aug 5, 2024
swathipil added a commit that referenced this pull request Sep 26, 2024
swathipil added a commit that referenced this pull request Sep 30, 2024
* Revert "[EventHub] Raise error when primary key is rotated (#36245)"

This reverts commit 3b2dfa4.

* skip windows tests
w-javed pushed a commit to w-javed/azure-sdk-for-python that referenced this pull request Oct 3, 2024
)

* Revert "[EventHub] Raise error when primary key is rotated (Azure#36245)"

This reverts commit 3b2dfa4.

* skip windows tests
l0lawrence pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
* sync side fix for rotate primary key issue in hub

* sync uamqp transport

* add to async

* remove print/cleanup

* mypy/pylint

* changelog

* fix logging formatting

* no retry on all auth exceptions

* remove import error in uamqp recv, b/c no external dependency

* mypy
l0lawrence pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
)

* Revert "[EventHub] Raise error when primary key is rotated (Azure#36245)"

This reverts commit 3b2dfa4.

* skip windows tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants