Skip to content

ErrorHandler should cleanup the scope#2059

Merged
st0012 merged 2 commits intomasterfrom
fix-#2012
Jun 26, 2023
Merged

ErrorHandler should cleanup the scope#2059
st0012 merged 2 commits intomasterfrom
fix-#2012

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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.

st0012 added 2 commits June 25, 2023 15:38
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
@st0012 st0012 deleted the fix-#2012 branch June 26, 2023 13:11
@github-actions
Copy link
Copy Markdown

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