Skip to content

[INTERNAL] AddressEnumerator: Fixes IndexOutOfRangeException Observed in AddressEnumerator #5126

Merged
FabianMeiswinkel merged 6 commits intomasterfrom
users/dibahl/addressEnumeratorConcurrencyFix
Apr 15, 2025
Merged

[INTERNAL] AddressEnumerator: Fixes IndexOutOfRangeException Observed in AddressEnumerator #5126
FabianMeiswinkel merged 6 commits intomasterfrom
users/dibahl/addressEnumeratorConcurrencyFix

Conversation

@dibahlfi
Copy link
Copy Markdown
Member

Due to a race condition between modifying and reading a shared variable FailedEndpoints which is instantiated in the DocumentServiceRequestContext class. multiple threads seems to be accessing it at the same time - one adding to it in the AddToFailedEndpoints() method in the DocumentServiceRequestContext and the other in the AddressEnumerator where it is trying to read an item in the GetEffectiveStatus() method which is called with in MoveFailedReplicasToTheEnd() and it results in an IndexOutOfRangeException . We need to move to a thread safe data structure.

[] Bug fix (non-breaking change which fixes an issue)

Closing issues

To automatically close an issue: closes #5046

@kirankumarkolli kirankumarkolli changed the title "[Internal] : Fixes IndexOutOfRangeException Observed in AddressEnumerator AddressEnumerator: Fixes IndexOutOfRangeException Observed in AddressEnumerator Apr 14, 2025
Comment thread Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough

Copy link
Copy Markdown
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dibahlfi dibahlfi added the auto-merge Enables automation to merge PRs label Apr 15, 2025
@kundadebdatta kundadebdatta added auto-merge Enables automation to merge PRs and removed auto-merge Enables automation to merge PRs labels Apr 15, 2025
@kirankumarkolli kirankumarkolli changed the title AddressEnumerator: Fixes IndexOutOfRangeException Observed in AddressEnumerator [INTERNAL] AddressEnumerator: Fixes IndexOutOfRangeException Observed in AddressEnumerator Apr 15, 2025
@FabianMeiswinkel FabianMeiswinkel merged commit 0ca35ae into master Apr 15, 2025
26 checks passed
@FabianMeiswinkel FabianMeiswinkel deleted the users/dibahl/addressEnumeratorConcurrencyFix branch April 15, 2025 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enables automation to merge PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fundamentals: Troubleshoot, Identify and Fix IndexOutOfRangeException Observed in AddressEnumerator::MoveFailedReplicasToTheEnd() Method

4 participants