GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Gracefully shutdown background worker before the process exits by st0012 · Pull Request #1617 · getsentry/sentry-ruby

Conversation

@st0012

@st0012 st0012 commented Nov 13, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Currently, when a process exits, SDK's background worker will discard all WIP sending tasks and cause lost of events. This is why we need to disable background worker in rake integration. And from the discussion in #1612, it seems to cause issues in the resque integration too.

Even though I want to avoid using the at_exit block, I don't think the responsibility of shutting down the background worker should fall on users. It should be handled by the SDK whenever possible. So in addition to providing a shutdown API in this PR, the SDK would also start the shutdown procedure when exiting the process.

Closes #1612

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@st0012 st0012 self-assigned this Nov 13, 2021
@codecov-commenter

codecov-commenter commented Nov 13, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #1617 (d544a63) into master (bf37772) will decrease coverage by 2.37%.
The diff coverage is 76.92%.

❗ Current head d544a63 differs from pull request most recent head 84715a1. Consider uploading reports for the commit 84715a1 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1617      +/-   ##
==========================================
- Coverage   98.51%   96.13%   -2.38%     
==========================================
  Files         133      107      -26     
  Lines        7394     6105    -1289     
==========================================
- Hits         7284     5869    -1415     
- Misses        110      236     +126     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/breadcrumb.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/breadcrumb/sentry_logger.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/breadcrumb_buffer.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/client.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/configuration.rb 98.41% <ø> (ø)
sentry-ruby/lib/sentry/core_ext/object/deep_dup.rb 94.11% <ø> (ø)
...ntry-ruby/lib/sentry/core_ext/object/duplicable.rb 60.00% <ø> (ø)
sentry-ruby/lib/sentry/dsn.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/envelope.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/exceptions.rb 100.00% <ø> (ø)
... and 71 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf37772...84715a1. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@st0012 st0012 mentioned this pull request Nov 13, 2021
Synchronously drain async error reporting queue #1612
Closed
@st0012 st0012 added bug fix sentry-ruby labels Nov 13, 2021
@st0012 st0012 added this to the 5.0.0 milestone Nov 13, 2021
@rhcarvalho rhcarvalho changed the title Gracefully shutdown background worker before the process exists Gracefully shutdown background worker before the process exits Nov 16, 2021
@st0012 st0012 modified the milestones: 5.0.0, 4.8.1 Nov 19, 2021
@st0012
st0012 requested a review from sl0thentr0py November 22, 2021 17:57
st0012 added 2 commits November 22, 2021 17:59
@st0012
Support BackgroundWorker#shutdown
56db64b
@st0012
Gracefully shutdown background worker and remove manual synchronizing…
32876bf
… code
@st0012
st0012 force-pushed the fix-#1612 branch from c93dea0 to 32876bf Compare November 22, 2021 17:59
sl0thentr0py
sl0thentr0py approved these changes Nov 22, 2021
View reviewed changes

@sl0thentr0py sl0thentr0py left a comment

Copy link
Copy Markdown
Member

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.

very cool! I was just explaining this to support the other day why his test code wasn't working because the parent process died without flushing.
Thanks for adding!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@st0012

st0012 commented Nov 22, 2021

Copy link
Copy Markdown
Contributor Author

@sl0thentr0py np 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@st0012
Update changelog
84715a1
@st0012
st0012 merged commit 46e7072 into master Nov 22, 2021
@st0012
st0012 deleted the fix-#1612 branch November 22, 2021 18:09
@st0012 st0012 mentioned this pull request Jan 27, 2022
async option will be dropped. #1522
Closed
@st0012 st0012 mentioned this pull request Mar 14, 2022
(Active-)Job errors not send (sentry-resque) #1754
Closed
natikgadzhi
natikgadzhi reviewed Nov 4, 2023
View reviewed changes
Comment thread sentry-ruby/lib/sentry/rake.rb
def execute(args=nil)
return super unless Sentry.initialized? && Sentry.get_current_hub

Sentry.get_current_hub.with_background_worker_disabled do

@natikgadzhi natikgadzhi Nov 4, 2023

Copy link
Copy Markdown
Contributor

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.

Looking at execute here — isn't it just not doing anything in this form? Looks like it falls back to super in every branch, no? /cc @st0012

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sl0thentr0py sl0thentr0py mentioned this pull request Dec 13, 2023
Question about the override to Rake::Task#execute #2196
Closed
@st0012 st0012 mentioned this pull request Jan 1, 2024
Remove unnecessary Rake patch #2214
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sl0thentr0py sl0thentr0py sl0thentr0py approved these changes
+1 more reviewer
@natikgadzhi natikgadzhi natikgadzhi left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@st0012 st0012

Labels

sentry-ruby

Projects

None yet

Milestone

4.8.1

Development

Successfully merging this pull request may close these issues.

Synchronously drain async error reporting queue

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@st0012 @codecov-commenter @natikgadzhi @sl0thentr0py
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.