[PR #2445] [MERGED] Add a SIGINT handler for proper server shutdown #3718

Closed
opened 2026-04-25 00:16:47 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/2445
Author: @mikiher
Created: 12/25/2023
Status: Merged
Merged: 12/25/2023
Merged by: @advplyr

Base: masterHead: sigint-handler


📝 Commits (1)

  • 209847d Add a SIGINT handler for proper server shutdown

📊 Changes

1 file changed (+14 additions, -0 deletions)

View changed files

📝 server/Server.js (+14 -0)

📄 Description

I've noticed that once in a while (can't reproduce consistently), when hitting Ctrl+C to close ABS, the port is not properly released, and the next time I start the server I get EADDRINUSE error. I'm not sure what's the reason for that, but I thought adding a SIGINT handler that calls the server's stop method would be good practice anyway, and It would also provide a way for proper stopping in the upcoming Windows tray app.

I implemented this like many standard SIGINT handlers - the first SIGINT waits for server stop, the second exits immediately (the current behavior).


🔄 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/advplyr/audiobookshelf/pull/2445 **Author:** [@mikiher](https://github.com/mikiher) **Created:** 12/25/2023 **Status:** ✅ Merged **Merged:** 12/25/2023 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `sigint-handler` --- ### 📝 Commits (1) - [`209847d`](https://github.com/advplyr/audiobookshelf/commit/209847d98ad67118e567c767d4cd2b07c3d4427e) Add a SIGINT handler for proper server shutdown ### 📊 Changes **1 file changed** (+14 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/Server.js` (+14 -0) </details> ### 📄 Description I've noticed that once in a while (can't reproduce consistently), when hitting Ctrl+C to close ABS, the port is not properly released, and the next time I start the server I get EADDRINUSE error. I'm not sure what's the reason for that, but I thought adding a SIGINT handler that calls the server's stop method would be good practice anyway, and It would also provide a way for proper stopping in the upcoming Windows tray app. I implemented this like many standard SIGINT handlers - the first SIGINT waits for server stop, the second exits immediately (the current behavior). --- <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 2026-04-25 00:16:47 +02:00
adam closed this issue 2026-04-25 00:16:47 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3718