Skip to content

[06x] Handle termination signals in Daemon#3992

Merged
gonX merged 3 commits into
OpenTabletDriver:0.6.xfrom
gonX:06x-graceful-shutdown
Dec 12, 2025
Merged

[06x] Handle termination signals in Daemon#3992
gonX merged 3 commits into
OpenTabletDriver:0.6.xfrom
gonX:06x-graceful-shutdown

Conversation

@gonX
Copy link
Copy Markdown
Member

@gonX gonX commented Aug 18, 2025

SIGINT/SIGTERM/SIGHUP etc would cause the daemon to not properly clean up the named pipes, causing issues on multi-user Linux systems.

This commit uses a cancellation token to instruct the daemon to abort taking further connections, and then the handler waits for the daemon to finish

Fixes #3804

I recommend reviewing the diff with "ignore whitespace" enabled.

SIGINT/SIGTERM/SIGHUP etc would cause the daemon to not properly clean up the named pipes, causing issues on multi-user Linux systems.

This commit uses a cancelation token to instruct the daemon to abort taking further connections, and then the handler waits for the daemon to finish
@gonX gonX added enhancement New feature or request daemon Affects the driver itself desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. labels Aug 18, 2025
Comment on lines +163 to +165
// ReSharper disable once LoopVariableIsNeverChangedInsideLoop
// ReSharper disable once AccessToModifiedClosure
while (daemonRunning)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please review these lines carefully, daemonRunning is modified outside of the function and I am not sure of the best approach here

@gonX gonX added this to the v0.6.6 milestone Aug 27, 2025
Comment thread OpenTabletDriver.Desktop/RPC/RpcHost.cs Outdated
Should allow shutdowns with connected clients

Co-authored-by: Aki Sakurai <75532970+AkiSakurai@users.noreply.github.com>
Copy link
Copy Markdown
Member

@Kuuuube Kuuuube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Works. Does the UX need this too? It leaves behind a pipe.

@gonX
Copy link
Copy Markdown
Member Author

gonX commented Dec 5, 2025

Oh, yes, the UX actually does need this too. I think this also needs testing with our osu-framework integration.

@gonX gonX changed the title [06x] Handle termination signals [06x] Handle termination signals in Daemon Dec 5, 2025
@gonX gonX merged commit 089ec23 into OpenTabletDriver:0.6.x Dec 12, 2025
12 checks passed
@gonX gonX deleted the 06x-graceful-shutdown branch December 12, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

daemon Affects the driver itself desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot start the daemon after switching user because CoreFxPipe_OpenTabletDriver.Daemon is not removed from /tmp

3 participants