Skip to content
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

ErrorHandler should cleanup the scope #2059

Merged
merged 2 commits into from
Jun 26, 2023
Merged

ErrorHandler should cleanup the scope #2059

merged 2 commits into from
Jun 26, 2023

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Jun 25, 2023

Because ErrorHandler is called outside of context middlewares, we don't clean the scope when an exception occurs. This makes sure ErrorHandler can have the context data set by middlewares. However, this also means that those states would be left uncleaned after the exception is captured.

This commit makes sure that the scope is cleaned up after the exception is captured.

Closes #2012

@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (5054dbe) 83.22% compared to head (3124a6c) 83.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2059   +/-   ##
=======================================
  Coverage   83.22%   83.23%           
=======================================
  Files         119      119           
  Lines        5662     5665    +3     
=======================================
+ Hits         4712     4715    +3     
  Misses        950      950           
Impacted Files Coverage Δ
sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb 93.10% <100.00%> (+0.24%) ⬆️
sentry-sidekiq/spec/sentry/sidekiq_spec.rb 97.43% <100.00%> (+0.03%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Because ErrorHandler is called outside of context middlewares,
we don't clean the scope when an exception occurs. This makes sure
ErrorHandler can have the context data set by middlewares. However, this
also means that those states would be left uncleaned after the exception is captured.

This commit makes sure that the scope is cleaned up after the exception is captured.
@st0012 st0012 merged commit 3131c7d into master Jun 26, 2023
97 checks passed
@st0012 st0012 deleted the fix-#2012 branch June 26, 2023 13:11
@github-actions
Copy link

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- ErrorHandler should cleanup the scope ([#2059](https://github.com/getsentry/sentry-ruby/pull/2059))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 3124a6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sidekiq scope potentially leaks when there's an exception
2 participants