Skip to content

fix: macOS server crash when client disconnects abruptly - #9331

Merged
nbolton merged 1 commit into
deskflow:masterfrom
gayanMatch:fix_9141
Jan 12, 2026
Merged

fix: macOS server crash when client disconnects abruptly#9331
nbolton merged 1 commit into
deskflow:masterfrom
gayanMatch:fix_9141

Conversation

@gayanMatch

@gayanMatch gayanMatch commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes server crash with exit code 13 (SIGPIPE) on macOS when a Windows client disconnects abruptly (e.g., shutdown/restart without stopping Deskflow first).

Problem

When a client disconnects unexpectedly, the server attempts to write to the closed socket (via OpenSSL's SSL_write or SSL_shutdown), which generates a SIGPIPE signal that terminates the process.

Related log output:

ERROR: tls error occurred (system call failure)
IPC: client "windows-pc" has disconnected
WARNING: desktop process exited with code: 13

Solution

Two-layer fix:

  1. SO_NOSIGPIPE socket option on macOS (ArchNetworkBSD.cpp)

    • Set on newly created sockets in newSocket()
    • Set on accepted client connections in acceptSocket()
    • Prevents SIGPIPE from being generated; returns EPIPE error instead
  2. Quiet TLS shutdown (SecureSocket.cpp)

    • Added SSL_set_quiet_shutdown() before SSL_shutdown() in freeSSL()
    • Skips writing close_notify alert when connection is already broken

Related Issues

Fixes #9141
Fixes #9314


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=132382032

@gayanMatch
gayanMatch requested a review from a team January 10, 2026 00:05
Comment thread src/lib/net/SecureSocket.cpp

@sithlord48 sithlord48 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok Ill leave this to @nbolton to land after his review

@sithlord48 sithlord48 added 🍎 mac This issue affects macOS 🩹 fix This PR fixes a reported bug labels Jan 10, 2026
@sithlord48

sithlord48 commented Jan 10, 2026

Copy link
Copy Markdown
Member

I wonder if this could fix also #9314 (Had the reporting user check and this seams to so adding to the list of bugs this closes)

@nbolton
nbolton merged commit 35ee17f into deskflow:master Jan 12, 2026
60 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🍎 mac This issue affects macOS 🩹 fix This PR fixes a reported bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client disconnects from server when server process is stopped macOS server crash: tls error occurred (system call failure)

3 participants