You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Telemetry Logging] LegacyTagJoiner and ModernTagJoiner could cause OutOfMemoryException #7505
LegacyTagJoiner dynamically calculates its Count property and its GetEnumerator() method iterates over items that could change dynamically during the iteration. This could lead to OOM if not used properly. See reproduction steps.
The same issue exists in ModernTagJoiner as well.
Reproduction Steps
Add and run the following unit test. The memory will start growing and eventually an OOM will be thrown.
When AddRange enumerates source that references the joiner while adding to _extraTags (an inner collection in joiner holding its items), Count increases with each added item --> the enumerator loop never terminates --> unbounded memory growth until OOM.
Expected behavior
OOM shouldn't be thrown, items from the source should be added to the joiner.
Actual behavior
An infinite loop adding items from the source to the joiner causes OOM.
Regression?
No response
Known Workarounds
If you materialize the source by invoking ToArray or ToList the items will be added to the joiner and OOM will not be thrown.
Activity
Fix unbounded enumeration of logging tag joiners
Fix unbounded enumeration of logging tag joiners