[PR #2113] [MERGED] Fix slow shutdown #2506

Closed
opened 2025-12-29 03:21:34 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2113
Author: @kradalby
Created: 9/9/2024
Status: Merged
Merged: 9/9/2024
Merged by: @kradalby

Base: mainHead: kradalby/shutdown-1968


📝 Commits (4)

📊 Changes

4 files changed (+57 additions, -21 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 cmd/headscale/cli/serve.go (+5 -2)
📝 hscontrol/app.go (+18 -18)
📝 hscontrol/notifier/notifier.go (+33 -1)

📄 Description

Turns out we were waiting for connections to close, without telling them to close...

Now:

  • Shutdown the HTTP server, so no new client conns are accepted
  • Shutdown notifier, telling all the clients to disconnect
  • Wait for all polls to close

Fixes #1968

Signed-off-by: Kristoffer Dalby kristoffer@tailscale.com

Summary by CodeRabbit

  • New Features

    • Introduced improved error handling for server shutdown scenarios, enhancing clarity in error reporting.
    • Added a mechanism in the Notifier to track its lifecycle, preventing operations after closure.
  • Bug Fixes

    • Resolved an issue where shutting down the headscale application would hang, ensuring a smoother shutdown process.
  • Documentation

    • Updated the changelog to reflect the recent fixes and improvements.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2113 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 9/9/2024 **Status:** ✅ Merged **Merged:** 9/9/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/shutdown-1968` --- ### 📝 Commits (4) - [`e629e12`](https://github.com/juanfont/headscale/commit/e629e120fccd0415ce8062444f01d75a16184daf) rearrange shutdown - [`1ac07cd`](https://github.com/juanfont/headscale/commit/1ac07cda2b6b62e4c7027b2276506995c2a1664a) http closed is fine - [`71ef689`](https://github.com/juanfont/headscale/commit/71ef689fa64da807f2602675f810b4af91c9bc65) update changelog - [`f7444d7`](https://github.com/juanfont/headscale/commit/f7444d73a1079f7f04c8411d52b7ea8df8a490de) logging while shutting ### 📊 Changes **4 files changed** (+57 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `cmd/headscale/cli/serve.go` (+5 -2) 📝 `hscontrol/app.go` (+18 -18) 📝 `hscontrol/notifier/notifier.go` (+33 -1) </details> ### 📄 Description Turns out we were waiting for connections to close, without telling them to close... Now: - Shutdown the HTTP server, so no new client conns are accepted - Shutdown notifier, telling all the clients to disconnect - Wait for all polls to close Fixes #1968 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced improved error handling for server shutdown scenarios, enhancing clarity in error reporting. - Added a mechanism in the Notifier to track its lifecycle, preventing operations after closure. - **Bug Fixes** - Resolved an issue where shutting down the headscale application would hang, ensuring a smoother shutdown process. - **Documentation** - Updated the changelog to reflect the recent fixes and improvements. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:21:34 +01:00
adam closed this issue 2025-12-29 03:21:34 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2506