fix(profiling): Fix race condition while processing profiles#4553
Closed
szokeasaurusrex wants to merge 1 commit into
Closed
fix(profiling): Fix race condition while processing profiles#4553szokeasaurusrex wants to merge 1 commit into
szokeasaurusrex wants to merge 1 commit into
Conversation
If multiple threads happen to be processing profiles, we could encounter a race condition, that would lead to more profiles being processed than are available in the `new_profiles` deque. To avoid this, we can break upon encountering an `IndexError`. This line appears to be the most likely cause of #4542 – in any case, handling an `IndexError` is not harmful Fixes #4542
Member
|
@Zylphrex already fixed a similar issue here and was released in https://github.com/getsentry/sentry-python/releases/tag/2.31.0. The report in #4542 is on 2.30.0 so I believe this is not needed, I would ask them to test on latest version again. |
Member
Author
|
True, nice catch @sl0thentr0py! |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #4553 +/- ##
==========================================
+ Coverage 80.63% 80.66% +0.02%
==========================================
Files 156 156
Lines 16482 16486 +4
Branches 2802 2802
==========================================
+ Hits 13291 13299 +8
+ Misses 2308 2302 -6
- Partials 883 885 +2
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If multiple threads happen to be processing profiles, we could encounter a race condition, that would lead to more profiles being processed than are available in the
new_profilesdeque. To avoid this, we can break upon encountering anIndexError.This line appears to be the most likely cause of #4542 – in any case, handling an
IndexErroris not harmfulFixes #4542
Thank you for contributing to
sentry-python! Please add tests to validate your changes, and lint your code usingtox -e linters.Running the test suite on your PR might require maintainer approval.