Skip to content

Rafaator single-instance handling on a pipe-only design - #966

Merged
albertospelta merged 1 commit into
mainfrom
alberto/refactor/singleInstance
Aug 3, 2026
Merged

Rafaator single-instance handling on a pipe-only design#966
albertospelta merged 1 commit into
mainfrom
alberto/refactor/singleInstance

Conversation

@albertospelta

Copy link
Copy Markdown
Member

The old singleton-instance mechanism combined a Mutex ownership gate and a named-pipe activation channel. The two could disagree: the mutex could still be held while the pipe listener was dead, so relaunching Bravo would time out against an owner that never answered and exit silently.

Ownership is now arbitrated by the pipe itself (single server instance), so it cannot outlive the ability to answer. Split into a generic Infrastructure/SingleInstance component and a thin Host/BravoApplicationInstance that owns Bravo's naming, wire format and error reporting. Identity is WindowsIdentity.User, stable across UAC elevation and deployment channel.

Also fixes found while reviewing the rewrite: listener restarts before dispatching (no longer starves later instances), a read timeout bounds each connection (a silent client can't hold the pipe forever), an oversized payload is reported instead of silently dropped, and the payload is UTF-8 instead of UTF-16.

The old singleton-instance mechanism combined a Mutex ownership gate and a named-pipe activation channel. The two could disagree: the mutex could still be held while the pipe listener was dead, so relaunching Bravo would time out against an owner that never answered and exit silently.

Ownership is now arbitrated by the pipe itself (single server instance), so it cannot outlive the ability to answer. Split into a generic Infrastructure/SingleInstance component and a thin Host/BravoApplicationInstance that owns Bravo's naming, wire format and error reporting. Identity is WindowsIdentity.User, stable across UAC elevation and deployment channel.

Also fixes found while reviewing the rewrite: listener restarts before dispatching (no longer starves later instances), a read timeout bounds each connection (a silent client can't hold the pipe forever), an oversized payload is reported instead of silently dropped, and the payload is UTF-8 instead of UTF-16.
@albertospelta
albertospelta marked this pull request as ready for review August 3, 2026 12:46
@albertospelta
albertospelta merged commit 20c6ae4 into main Aug 3, 2026
1 check passed
@albertospelta
albertospelta deleted the alberto/refactor/singleInstance branch August 3, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant