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

Graceful shutdown #243

Merged
merged 12 commits into from
Jun 22, 2021
Merged

Graceful shutdown #243

merged 12 commits into from
Jun 22, 2021

Conversation

kolesnikovae
Copy link
Collaborator

@kolesnikovae kolesnikovae commented Jun 16, 2021

This pull request is aimed to improve pyroscope shutdown and initialisation.

  • controller (http server) is drained at the very beginning of the shutdown to prevent storage reads and writes. Diagnostic endpoints (healthz, metrics, pprof) are handled till the storage closes, thus allowing clean exit.
  • removed IsClosing check from storage: it is guaranteed that no calls to storage will be made after Close.
  • atexit package was removed.
  • Closes Relay POSIX signals in exec #232.

@kolesnikovae kolesnikovae added enhancement New feature or request 🧹 cleanup Important, but often overlooked. Great first issues backend Mostly go code labels Jun 16, 2021
# Conflicts:
#	pkg/cli/server_unix.go
#	pkg/server/controller.go
#	pkg/storage/local.go
#	pkg/storage/storage.go
#	pkg/util/atexit/atexit.go
@kolesnikovae kolesnikovae self-assigned this Jun 17, 2021
@kolesnikovae kolesnikovae marked this pull request as ready for review June 17, 2021 14:37
@kolesnikovae kolesnikovae requested review from alonlong and petethepig and removed request for alonlong June 17, 2021 14:37
@github-actions github-actions bot requested a review from Rperry2174 June 17, 2021 14:37
@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #243 (59435c4) into main (b78084d) will decrease coverage by 0.52%.
The diff coverage is 37.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #243      +/-   ##
==========================================
- Coverage   54.64%   54.12%   -0.51%     
==========================================
  Files          86       87       +1     
  Lines        3606     3631      +25     
==========================================
- Hits         1970     1965       -5     
- Misses       1431     1467      +36     
+ Partials      205      199       -6     
Impacted Files Coverage Δ
pkg/agent/upstream/direct/direct.go 0.00% <0.00%> (ø)
pkg/cli/cli.go 61.72% <0.00%> (+0.48%) ⬆️
pkg/cli/server.go 0.00% <0.00%> (ø)
pkg/cli/server_unix.go 0.00% <0.00%> (ø)
pkg/server/labels.go 0.00% <ø> (ø)
pkg/server/render.go 0.00% <0.00%> (ø)
pkg/storage/local.go 0.00% <0.00%> (ø)
pkg/util/debug/reporter.go 0.00% <0.00%> (ø)
pkg/agent/session.go 63.94% <33.34%> (+0.74%) ⬆️
pkg/exec/cli.go 49.26% <48.58%> (-0.03%) ⬇️
... and 10 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 b78084d...59435c4. Read the comment docs.

// Normally, if the program ran, the call should return ExitError and
// the exit code must be preserved. Otherwise, the error originates from
// pyroscope and will be printed.
if e, ok := err.(*goexec.ExitError); ok {
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@petethepig petethepig left a comment

Choose a reason for hiding this comment

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

It is so much better now, love it!

}

func (svc *serverService) Start() error {
g, ctx := errgroup.WithContext(context.Background())
Copy link
Member

Choose a reason for hiding this comment

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

👍🏼

@petethepig petethepig merged commit 2723d11 into main Jun 22, 2021
@petethepig petethepig deleted the graceful-shutdown branch June 22, 2021 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Mostly go code 🧹 cleanup Important, but often overlooked. Great first issues enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relay POSIX signals in exec
2 participants