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

debug: properly handle interrupted profiles #1191

Merged
merged 1 commit into from
Sep 3, 2017
Merged

Conversation

prattmic
Copy link
Contributor

By default (i.e., without profile.NoShutdownHook), profile.Start listens
for SIGINT and will stop the profile and call os.Exit(0).

restic already listens for SIGINT and runs its own cleanup handlers
before calling os.Exit(0).

As is, these handlers are racing when an interrupt occurs, and in my
experience, restic tends to win the race, resulting in an unusable
profile.

Eliminate the race and properly stop profiles on interrupt by disabling
package profile's signal handler and instead stop the profile in a
restic cleanup handler.

By default (i.e., without profile.NoShutdownHook), profile.Start listens
for SIGINT and will stop the profile and call os.Exit(0).

restic already listens for SIGINT and runs its own cleanup handlers
before calling os.Exit(0).

As is, these handlers are racing when an interrupt occurs, and in my
experience, restic tends to win the race, resulting in an unusable
profile.

Eliminate the race and properly stop profiles on interrupt by disabling
package profile's signal handler and instead stop the profile in a
restic cleanup handler.
@codecov-io
Copy link

codecov-io commented Aug 29, 2017

Codecov Report

Merging #1191 into master will decrease coverage by 5.76%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1191      +/-   ##
==========================================
- Coverage   52.93%   47.17%   -5.77%     
==========================================
  Files         126      126              
  Lines       12059    12055       -4     
==========================================
- Hits         6384     5687     -697     
- Misses       4930     5678     +748     
+ Partials      745      690      -55
Impacted Files Coverage Δ
cmd/restic/main.go 8% <ø> (+0.45%) ⬆️
cmd/restic/global_release.go 0% <ø> (ø) ⬆️
internal/backend/b2/b2.go 0% <0%> (-79.32%) ⬇️
internal/backend/swift/swift.go 0% <0%> (-73.9%) ⬇️
internal/backend/azure/azure.go 0% <0%> (-61.93%) ⬇️
internal/backend/gs/gs.go 0% <0%> (-59.85%) ⬇️
internal/backend/swift/config.go 34.37% <0%> (-56.25%) ⬇️
internal/archiver/archiver.go 64.79% <0%> (-0.17%) ⬇️

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 22e96a3...e4c469c. Read the comment docs.

Copy link
Member

@fd0 fd0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, this is indeed much nicer. Thank you very much for your contribution!

@fd0 fd0 merged commit e4c469c into restic:master Sep 3, 2017
fd0 added a commit that referenced this pull request Sep 3, 2017
debug: properly handle interrupted profiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants