Skip to content

fix(macos): prevent automatic termination during memory pressure - #9312

Merged
sithlord48 merged 2 commits into
deskflow:masterfrom
johnweldon:fix/macos-automatic-termination
Jan 2, 2026
Merged

fix(macos): prevent automatic termination during memory pressure#9312
sithlord48 merged 2 commits into
deskflow:masterfrom
johnweldon:fix/macos-automatic-termination

Conversation

@johnweldon

@johnweldon johnweldon commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

Disable macOS Automatic Termination to prevent the server/client from being killed during memory pressure events. Adds NSSupportsAutomaticTermination to Info.plist and programmatically disables termination in the Cocoa app.

Fixes #7329

🤖 Generated with Claude Code (But not AI Trash)

Edit: (sithlord48)

  • Updated to remove code. We only need plist or code change
  • Added a commit to put deskflow in the "Utilities" category

@johnweldon
johnweldon requested a review from a team December 31, 2025 21:37
sithlord48

This comment was marked as outdated.

Comment thread src/lib/platform/OSXCocoaApp.m Outdated
@sithlord48

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code (But not AI Trash)

I don't really care for little stuff like this that is gonna be a single line in the plist. I have issues when people are submitting patches that are large "AI" generated code they do not understand and also do not fully test.

@sithlord48
sithlord48 force-pushed the fix/macos-automatic-termination branch from 2ab2ca6 to bd2e374 Compare January 1, 2026 14:55

@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.

@nbolton This looks good to me now can you approve / land when ready. (I made a change so i can't anymore)
@johnweldon Ill keep this updated from here on out.

@nbolton nbolton 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.

Worth a shot! 🤷‍♂️

johnweldon and others added 2 commits January 2, 2026 11:46
Disable macOS Automatic Termination to prevent the server/client from
being killed during memory pressure events. Adds NSSupportsAutomaticTermination
to Info.plist and programmatically disables termination in the Cocoa app.

Fixes deskflow#7329

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@sithlord48
sithlord48 force-pushed the fix/macos-automatic-termination branch from bd2e374 to dbb9b70 Compare January 2, 2026 11:46
@sithlord48
sithlord48 enabled auto-merge (rebase) January 2, 2026 11:47
@sithlord48
sithlord48 merged commit 38722f7 into deskflow:master Jan 2, 2026
32 checks passed
@nbolton

nbolton commented May 1, 2026

Copy link
Copy Markdown
Member

@sithlord48 I'm wondering if this change is actually effective. According to the docs, the detail on NSSupportsAutomaticTermination mentions memory ("reclaim the memory used by the app") but as the rationale for terminating an already-idle app, not as the trigger.

NSSupportsAutomaticTermination (Boolean - macOS). This key contains a Boolean value that indicates whether the app supports automatic termination in OS X v10.7 and later. Automatic termination allows an app that is running to be terminated automatically by the system when certain conditions apply. Primarily, the app can be terminated when it is hidden or does not have any visible windows and is not currently being used. The system may terminate such an app in order to reclaim the memory used by the app.

An app may programmatically disable and reenable automatic termination support using the disableAutomaticTermination and enableAutomaticTermination methods of NSProcessInfo. The app might do this to prevent being terminated during a critical operation.

Memory-pressure terminations on macOS are actually handled by jetsam/memorystatus in the macOS kernel:
https://developer.apple.com/documentation/xcode/identifying-high-memory-use-with-jetsam-event-reports

AFAIK the kernel doesn't change it's behavior based on .plist files.AFAIK the kernel doesn't change it's behavior based on .plist files.

@johnweldon

Copy link
Copy Markdown
Contributor Author

FWIW, the issue has not re-occurred for me since this change.

@nbolton

nbolton commented May 2, 2026

Copy link
Copy Markdown
Member

FWIW, the issue has not re-occurred for me since this change.

Good to know, thanks for the info. What's memory use like after the Core process has been running a few days?

@johnweldon

johnweldon commented May 5, 2026 via email

Copy link
Copy Markdown
Contributor Author

@nbolton

nbolton commented May 6, 2026

Copy link
Copy Markdown
Member

Synergy 1.20.0, the Core process is sitting at ~18.7 MB RSS.

What about with Deskflow?

@johnweldon

Copy link
Copy Markdown
Contributor Author

What about with Deskflow?

@nbolton -- apologies, I muddled the two. The numbers I posted are from Symless's commercial Synergy 1.20.0 build (/Applications/Synergy.app), which is what I actually run on this machine day-to-day; I don't have a Deskflow build installed, so that data isn't apples-to-apples for what you're asking about. Feel free to disregard the earlier snapshot.

@nbolton

nbolton commented May 8, 2026

Copy link
Copy Markdown
Member

What about with Deskflow?

@nbolton -- apologies, I muddled the two. The numbers I posted are from Symless's commercial Synergy 1.20.0 build (/Applications/Synergy.app), which is what I actually run on this machine day-to-day; I don't have a Deskflow build installed, so that data isn't apples-to-apples for what you're asking about. Feel free to disregard the earlier snapshot.

I'm the maintainer of the Synergy 1 commercial downstream code. Changes from Deskflow flow down into Synergy over time, so if it's not happening in Synergy but is happening in Deskflow, then this is useful information. Would you be able to try Deskflow? Deskflow and Synergy 1 are protocol compatible so you'd only need to update your Mac.

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.

Random reconnects with Windows server and macOS client

3 participants