-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CosmosDiagnostics: Fixes memory leak due to unbounded growth of CosmosDiagnosticsContextCore and removes reference to response stream. #2129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"
Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"
Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.
Microsoft.Azure.Cosmos/src/Diagnostics/CosmosDiagnosticsContextCore.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/src/Diagnostics/CosmosDiagnosticsSerializerVisitor.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/src/Diagnostics/StoreResponseStatistics.cs
Outdated
Show resolved
Hide resolved
…to NetworkAttachedDocumentContainer hanging on to a single instance of diagnostics context and adding to it during long running operations
06840b9
to
e9b2d07
Compare
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosDiagnosticsUnitTests.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comments about thread-safety and the Region public API change
Pull Request Template
Description
NetworkAttachedDocumentContainer holds on to a single CosmosDiagnostics context, and adds diagnostics for each response to this context. for long running queries, this amounts to growing the size of CosmosDiagnostics without bound.
In addition StoreResponseStatistics was holding on the entire StoreResult object including the response stream, which leads to the very high memory consumption.
This change severs the link between StoreResponseStatistics and the StoreResult, and it also uses a bounded circular buffer instead of a list to store child contexts in CosmosDiagnosticsCore
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber