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

Improvements to signal handling #2379

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

fridrik01
Copy link
Contributor

@fridrik01 fridrik01 commented Jan 19, 2025

This PR makes the following improvements to signal handling, where during graceful shutdown we now:

  • only stops services which we called Start() on.
  • fixes critical section issue where we can call StopAll twice during shutdown if signal was received while in the middle of Startup.
  • only call StopAll during signal handling as that is the only way to stop the service
  • simplifies the signal handling to use a simple blocking channel
  • call panic if we can't shutdown within receiving 10x SIGTERM signals.

@fridrik01 fridrik01 self-assigned this Jan 19, 2025
Copy link

codecov bot commented Jan 19, 2025

Codecov Report

Attention: Patch coverage is 20.51282% with 31 lines in your changes missing coverage. Please review.

Project coverage is 31.60%. Comparing base (6581265) to head (9cdd7ab).

Files with missing lines Patch % Lines
node-core/node/node.go 0.00% 22 Missing ⚠️
node-core/services/registry/registry.go 47.05% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2379      +/-   ##
==========================================
+ Coverage   31.57%   31.60%   +0.03%     
==========================================
  Files         348      348              
  Lines       15530    15527       -3     
  Branches       20       20              
==========================================
+ Hits         4903     4907       +4     
+ Misses      10283    10276       -7     
  Partials      344      344              
Files with missing lines Coverage Δ
node-core/services/registry/registry.go 48.71% <47.05%> (-2.03%) ⬇️
node-core/node/node.go 0.00% <0.00%> (ø)

@fridrik01 fridrik01 force-pushed the fix-signal-handling branch from 947fb93 to 836aa5d Compare January 19, 2025 21:56
@fridrik01 fridrik01 changed the title improve signal handling Improvements to signal handling Jan 20, 2025
@fridrik01 fridrik01 marked this pull request as ready for review January 20, 2025 20:04
@fridrik01 fridrik01 requested a review from a team as a code owner January 20, 2025 20:04
@fridrik01 fridrik01 force-pushed the fix-signal-handling branch 3 times, most recently from 46e8387 to 9be87e1 Compare January 28, 2025 20:08
@fridrik01 fridrik01 force-pushed the fix-signal-handling branch from 0c9b215 to 19c3826 Compare January 31, 2025 12:36
@fridrik01 fridrik01 force-pushed the fix-signal-handling branch from 19c3826 to 9cdd7ab Compare January 31, 2025 14:26
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.

1 participant