-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix issue with Envoy not reference counting across scopes under not-hot restart #3249
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3d5849d
First working draft of simpler reference-counted heap allocator
ambuc b6aa029
Fixed reference to pointer to RawStatData
ambuc d615eef
Add HeapAlloc test for HeapRawStatDataAllocator
ambuc cdd8418
Initialized data based on truncated name
ambuc 101c7aa
Remove leftover comments
ambuc 282c56b
Initialized data based on non-truncated name
ambuc 830c718
Initialized data based on truncated name, and also warn in both alloc…
ambuc 4de411a
Remove leftover couts
ambuc 11a8cdb
First working draft of simpler reference-counted heap allocator
ambuc ecd7714
Fixed reference to pointer to RawStatData
ambuc 8c00102
Add HeapAlloc test for HeapRawStatDataAllocator
ambuc ddcb0f9
Initialized data based on truncated name
ambuc 7031caa
Remove leftover comments
ambuc 93eb3d7
Initialized data based on non-truncated name
ambuc b4b1b39
Initialized data based on truncated name, and also warn in both alloc…
ambuc 7e2b8d6
Remove leftover couts
ambuc 96582ad
Merge branch 'refcount-stats-in-heap-alloc' of https://github.com/amb…
ambuc bec4fac
Fix free stat issue, typedef datamap, assorted
ambuc ea27f46
Add mutex to HeapRawStatDataAllocator
ambuc a4eb61e
Rename mutex, make non-mutable
ambuc b388492
Use unordered_set<> for HeapRawStatDataAllocator's stats
ambuc 3b9d839
Tighten mutex; remove temp key
ambuc b10f663
Minimize time spent holding lock
ambuc 759e6d9
Fix camelCase style issue
ambuc 8a8a39d
Add more robust null checking around RawDataTest/Truncate
ambuc f0e19ae
Change EXPECTs to ASSERTs in RawStatDataTest/Truncate
ambuc 76ebd08
Tighten mutex around HeapRawStatDataAllocator::free()
ambuc 87318c0
More specific asserts around unordered_map::erase behavior
ambuc 84913f9
Merge branch 'master' into refcount-stats-in-heap-alloc
ambuc 5194ec2
Add GUARDED_BY to mutex_, documentation around StringRawDataSet
ambuc ce99186
Merge branch 'master' into refcount-stats-in-heap-alloc
ambuc 5429301
Formatting updates
ambuc 40ae83b
Add documentation for HeapRawStatDataAllocator
ambuc 20526e7
Edits for documentation for HeapRawStatDataAllocator
ambuc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need locking at all if the old comment about "This allocator does not ever have concurrent access to the raw data" hold true?
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.
The problem isn't the stat, it's the set.
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.
+1. Also, side note: that comment is no longer valid since the same stat can be freed/allocated multiple times, meaning that there may be cases where the allocator is operating on the same raw stat from two different threads.
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.
AFAICT we only ever do these allocations under existing locking, e.g.
envoy/source/common/stats/thread_local_store.cc
Line 192 in 872728d
I might be wrong in my assessment, please point out if not (and add a comment to the code!).
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, good point, there probably need to be comments around this. The
alloc()calls are protected, but thefree()calls are made from the destructors of the individual stat objects. See https://github.com/envoyproxy/envoy/blob/master/source/common/stats/stats_impl.h#L310 for an example.