Fix resource cleanup for signal shutdown#8847
Merged
chrisduerr merged 6 commits intoalacritty:masterfrom Mar 5, 2026
Merged
Conversation
cc56ce9 to
5160c28
Compare
7829111 to
a026b73
Compare
kchibisov
requested changes
Feb 24, 2026
8804318 to
c6b2acf
Compare
Member
Author
|
Rewrote the IPC thread to act as a generic I/O event listener and that honestly cleaned up things very nicely. If inotify could integrate into that too it would be beautiful tbh (but not planning on that in this patch). |
kchibisov
approved these changes
Mar 2, 2026
This fixes an issue where Alacritty's resources, like its socket, would stick around after getting killed, since termination signals like SIGTERM were not handled explicitly. To handle these signals, a new worker thread is spawned that just listens for SIGTERM and SIGINT using signal-hook, which we were already pulling for alacritty_terminal anyway. While this does not provide support for Windows, we also do not have an IPC socket on Windows we need to clean up. The current `Signals` implementation does not support Windows, but alternatives like the `ctrlc` crate exist. This does spawn a dedicated thread which is going to sit idle for the entire lifetime of Alacritty, which is somewhat unfortunate. However since Winit does not support listening for files like the pipes supported by signal-hook, this seems like the only solution which would not require significant effort in winit. Closes alacritty#8805.
While technically this isn't needed, since signals always cause shutdown, this might be useful if we ever add support for handling other signals.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an issue where Alacritty's resources, like its socket, would stick around after getting killed, since termination signals like SIGTERM were not handled explicitly.
To handle these signals, a new worker thread is spawned that just listens for SIGTERM and SIGINT using signal-hook, which we were already pulling for alacritty_terminal anyway.
While this does not provide support for Windows, we also do not have an IPC socket on Windows we need to clean up. The current
Signalsimplementation does not support Windows, but alternatives like thectrlccrate exist.This does spawn a dedicated thread which is going to sit idle for the entire lifetime of Alacritty, which is somewhat unfortunate. However since Winit does not support listening for files like the pipes supported by signal-hook, this seems like the only solution which would not require significant effort in winit.
Closes #8805.
I kinda hate this, but it's probably better than not cleaning up the IPC socket.