Stopping via systemd leads to kill after timeout #286

Closed
opened 2025-12-29 01:26:12 +01:00 by adam · 3 comments
Owner

Originally created by @nblock on GitHub (Jun 25, 2022).

Bug description

Invoking: systemctl restart headscale hangs until systemd hits the stop timeout. Afterwards headscale is killed.

To Reproduce

Systemd service file:

[Unit]
Description=Headscale (version: 0.16.0-beta4)
[Service]
Type=simple
User=headscale
Group=headscale
RuntimeDirectory=headscale
Environment=GIN_MODE=release
ExecStart=/usr/local/bin/headscale serve
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
ReadWritePaths=/var/lib/headscale/.headscale
ReadWritePaths=/var/run/headscale

[Install]
WantedBy=multi-user.target

Logs:

headscale.service: State 'stop-sigterm' timed out. Killing.                   
headscale.service: Killing process 31565 (headscale) with signal SIGKILL.                                                                                                                                  
headscale.service: Killing process 31566 (headscale) with signal SIGKILL.                                                                                                                                  
headscale.service: Killing process 31567 (headscale) with signal SIGKILL.                                                                                                                                  
headscale.service: Killing process 31568 (n/a) with signal SIGKILL.                                                                                                                                        
headscale.service: Killing process 31569 (headscale) with signal SIGKILL.     
headscale.service: Killing process 31570 (headscale) with signal SIGKILL.                                                                                                                                  
headscale.service: Killing process 31571 (headscale) with signal SIGKILL.                                                                                                                                  
headscale.service: Killing process 31572 (headscale) with signal SIGKILL.      
headscale.service: Main process exited, code=killed, status=9/KILL                                                                                                                                         
headscale.service: Failed with result 'timeout'.                                                                                                                                                           
Stopped Headscale (version: 0.16.0-beta4).  

Context info
Headscale: 0.16.-beta4

Originally created by @nblock on GitHub (Jun 25, 2022). **Bug description** Invoking: `systemctl restart headscale` hangs until systemd hits the stop timeout. Afterwards headscale is killed. **To Reproduce** Systemd service file: ``` [Unit] Description=Headscale (version: 0.16.0-beta4) [Service] Type=simple User=headscale Group=headscale RuntimeDirectory=headscale Environment=GIN_MODE=release ExecStart=/usr/local/bin/headscale serve ExecReload=/usr/bin/kill -HUP $MAINPID Restart=always RestartSec=5 ReadWritePaths=/var/lib/headscale/.headscale ReadWritePaths=/var/run/headscale [Install] WantedBy=multi-user.target ``` Logs: ``` headscale.service: State 'stop-sigterm' timed out. Killing. headscale.service: Killing process 31565 (headscale) with signal SIGKILL. headscale.service: Killing process 31566 (headscale) with signal SIGKILL. headscale.service: Killing process 31567 (headscale) with signal SIGKILL. headscale.service: Killing process 31568 (n/a) with signal SIGKILL. headscale.service: Killing process 31569 (headscale) with signal SIGKILL. headscale.service: Killing process 31570 (headscale) with signal SIGKILL. headscale.service: Killing process 31571 (headscale) with signal SIGKILL. headscale.service: Killing process 31572 (headscale) with signal SIGKILL. headscale.service: Main process exited, code=killed, status=9/KILL headscale.service: Failed with result 'timeout'. Stopped Headscale (version: 0.16.0-beta4). ``` **Context info** Headscale: 0.16.-beta4
adam added the bug label 2025-12-29 01:26:12 +01:00
adam closed this issue 2025-12-29 01:26:12 +01:00
Author
Owner

@juanfont commented on GitHub (Jun 25, 2022):

This should be fixed in https://github.com/juanfont/headscale/pull/656

@juanfont commented on GitHub (Jun 25, 2022): This should be fixed in https://github.com/juanfont/headscale/pull/656
Author
Owner

@juanfont commented on GitHub (Jun 26, 2022):

Can you try https://github.com/juanfont/headscale/releases/tag/v0.16.0-beta5 ?

@juanfont commented on GitHub (Jun 26, 2022): Can you try https://github.com/juanfont/headscale/releases/tag/v0.16.0-beta5 ?
Author
Owner

@nblock commented on GitHub (Jun 26, 2022):

Can you try https://github.com/juanfont/headscale/releases/tag/v0.16.0-beta5 ?

Looks good: systemctl stop headscale finishes in a few seconds with beta5.

@nblock commented on GitHub (Jun 26, 2022): > Can you try https://github.com/juanfont/headscale/releases/tag/v0.16.0-beta5 ? Looks good: `systemctl stop headscale` finishes in a few seconds with beta5.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#286