#10168·deskflow

Windows: deskflow-core runs in REALTIME_PRIORITY_CLASS — a single busy-waiting thread starves input and DWM (machine-wide stutter, not just "high CPU")

Author: mmcxujie-cpuCreated Sep 22, 2026Updated Sep 22, 2026
Labels🪟 windows

Before reporting a bug, please complete the sanity checks above.

  • I have done the sanity checks, and my issue persists.

Deskflow version info

Deskflow: 1.26.0.0 Qt: 6.10.1 System: Windows 11 Version 25H2 (Build 26200) Session: windows

Build types

Official release (installer/package from GitHub releases)

Deskflow configuration

  • Windows 11 client (Deskflow 1.26.0.0, official MSI release) + macOS server (Deskflow 1.26.0, official release)
  • One monitor on each machine
  • macOS runs in server mode with TLS enabled (Barrier protocol); Windows runs in client mode
  • Windows client: background daemon enabled, "always run as system" enabled, TLS enabled
  • Fresh install, no custom tuning. Relevant Deskflow.conf [internalConfig] keys: coreMode=1, protocol=1, heartbeat=5000, clipboardSharing=true, clipboardSharingSize=3072, relativeMouseMoves=false, win32KeepForeground=false, enableUpdateCheck=false
  • Everything else left at defaults; no screen layout customisation beyond the default 5x3 grid

What steps will reproduce the problem?

Reproducibility on this machine is 100% - it is deterministic, not intermittent.

  1. Install Deskflow 1.26.0 on a Windows 11 client, enable TLS, and connect to a Deskflow server.
  2. The moment the session is established, the whole machine starts to stutter (mouse cursor, browser, any Electron app) and stays that way - including immediately after a reboot, because the service auto-starts at boot.
  3. Check the process priority class: PS> Get-Process deskflow-core | Select-Object PriorityClass RealTime
  4. Measure process CPU on a completely idle desktop: PS> $p = Get-Process deskflow-core; $a = $p.TotalProcessorTime Start-Sleep 12 PS> ((Get-Process deskflow-core).TotalProcessorTime - $a).TotalSeconds 12.02 # = 100.1% of ONE core, on a 24-logical-processor machine

Three controlled experiments (one variable changed at a time, service restarted between runs, configuration restored afterwards):

Change Result
remoteHost -> 127.0.0.1 (no session) CPU delta 0.00 s / 12 s = 0.0% -> spin stops
Reconnect (encrypted session re-established) 100.1% of one core -> deterministic
clipboardSharing=false still 100% -> clipboard traffic is not the cause

So the spin starts the moment the secure session comes up, and stops the moment the session is gone.

Log output

Show log

[2026-09-22T11:15:09.216] INFO: network encryption protocol: TLSv1.3
[2026-09-22T11:39:13.250] INFO: connected to secure socket
[2026-09-22T11:39:13.250] INFO: server tls certificate info: /CN=Deskflow
[2026-09-22T11:39:13.250] INFO: network encryption protocol: TLSv1.3

This is the complete set of lines the daemon emits when the session comes up - there is no error, no warning, and no unusual output. The 100% single-core CPU load is completely silent in the log. The IPC: peer fingerprint: line has been removed because it is a certificate fingerprint.

Additional information

Not a duplicate

The TLS socket busy-spin that triggers the behaviour below was root-caused and fixed in #9977 (merged 2026-07-28, shipped in Continuous v1.26.0.443, published 2026-09-18). My build predates it. This report is not a duplicate of #9364 / #10001 / #8970. It is about a separate, still-unfixed defect that turns any such spin into a machine-wide stall: on Windows, deskflow-core sets its entire process to REALTIME_PRIORITY_CLASS.

Hardware (why "4% CPU" is enough to freeze the machine)

Intel Core Ultra 9 285K, 24 logical processors, 128 GB RAM. One spinning thread is therefore only ~4% of total CPU - which is exactly why this is easy to misdiagnose as a hardware problem. Task Manager showed ~6.7% total CPU while the machine was unusable; per-core counters showed a single core pinned at 100%.

What is actually happening

Every time a session is established, deskflow-core.exe sets the whole process to realtime priority:

Observation Value
deskflow-core.exe priority class, natural state RealTime / BasePriority=24
deskflow-daemon.exe (same service tree) Normal / BasePriority=8
Per-thread base priority inside core (session connected) 24, 24, 24, 24, 25 (all 5)
The one thread actually consuming CPU state=Running, 99% of a core
Process CPU, idle desktop, session up 99.4 - 100.1% of one core
Threads spinning vs waiting 1 spinning / 4 in Wait

The defect therefore has two independent halves:

  1. The spin - one thread busy-waits at 100% of a core once the encrypted session is up. Fixed by #9977 (SSL_write() busy-spin because ArchNetworkWinsock::pollSocket() never resets its cached writability for SecureSocket). My thread-level data matches that analysis exactly.
  2. The priority class - the process runs at REALTIME_PRIORITY_CLASS. This is what converts a busy-wait into a system-wide stall instead of a harmless wasted core. #9977 removes the trigger, but the priority class remains, so the next spin / deadlock / long synchronous operation inside deskflow-core will starve user input again.

A Windows detail makes it worse: LowLevelHooksTimeout defaults to 300 ms (confirmed unchanged on this machine). A realtime-priority thread sitting in the input path can therefore stall input delivery for the full timeout. A program whose purpose is to synthesize and forward input arguably should not run above HIGH_PRIORITY_CLASS.

Expected behaviour

deskflow-core.exe should run at normal or high priority, consume near-zero CPU when the desktop is idle, and - critically - never be able to preempt the user's input queue or DWM, so that a bug inside it degrades Deskflow itself instead of the whole login session.

Actual behaviour

deskflow-core.exe runs at REALTIME_PRIORITY_CLASS with all threads at base priority 24-25. Once the TLS session is established, one thread busy-waits at ~100% of a core, and because of that priority class the machine's input handling and compositor are starved to the point where the computer is unpleasant to use - while Task Manager shows only ~4-7% total CPU.

Requested change

  1. Stop using REALTIME_PRIORITY_CLASS. NORMAL_PRIORITY_CLASS should be sufficient; HIGH_PRIORITY_CLASS is the most aggressive option that is defensible for an input-forwarding program.
  2. If low input latency is the motivation, raise only what needs it - AvSetMmThreadCharacteristics (MMCSS / "Pro Audio"), timeBeginPeriod(1), or a higher priority on that specific thread - rather than lifting every thread of the process into the realtime range.
  3. Please reconsider whether a program that installs low-level input hooks should be allowed to outrank DWM and the input stack at all.

Answers to the questions above

Any ideas about what may be causing the problem?

Yes, and it is confirmed by experiment rather than inferred: the REALTIME_PRIORITY_CLASS plus the pre-#9977 TLS busy-spin. Disconnecting the session removes the spin (0.0% CPU); reconnecting restores it (100.1%); lowering the process priority removes the machine-wide stutter while the spin continues.

Any workarounds that you have discovered?

Yes, verified on this machine, with no loss of function:

powershell
(Get-Process deskflow-core).PriorityClass = 'Normal'

Measured effect: the single spinning thread drops from a preempting RealTime/24 to a non-preempting Normal process. Mouse/keyboard sharing and the established session keep working, and Deskflow does not re-raise the priority after this is set externally. The busy-wait itself continues (~99% of one core is still wasted), so this does not fix the spin - it only removes the machine-wide stall.

I made this persistent with a small scheduled task that demotes the process to Normal whenever it appears (and re-applies it every minute), which is how the machine is usable at all right now. That is a workaround, not a fix.

Not yet tested here: upgrading to Continuous v1.26.0.443, which should remove the spin itself. I intend to test that next, but the priority class issue would remain regardless.

What other apps are you running?

Nothing unusual and nothing that competes for the input path during the measurements: Huorong security (HipsDaemon), ASUS fan control service, Chrome, Feishu/QQ/DingTalk. All were measured during the same window and all showed ~0% CPU delta over 6 s, while deskflow-core showed 99.5%. No third-party input remapper or macro tool is installed.

Does the issue stop you using Deskflow entirely?

It did initially - the whole login session was too laggy to work in, including for typing. With the priority-demotion workaround above the machine is usable again, so no, but the margin is entirely dependent on an external script.

Did restarting Deskflow or the computer help?

No. Restarting the computer makes it worse, not better: the service is Automatic and comes up within seconds of boot, so the machine is already stuttering ~11 seconds after login. Stopping the service removes the stutter immediately.

Are the locales matching across all your systems?

The Windows side is zh-CN. I do not believe locale is relevant here: the spin and the stutter are fully controlled by whether a session exists, not by any locale-dependent code path - with no session the CPU delta is exactly 0.00 s / 12 s.

Anything else?

Possibly related: #9621 (Crash in deskflow-core.exe (0xc0000409) at ucrtbase.dll). My Windows Error Reporting entries for deskflow-core.exe show an identical signature - exception 0xc0000409, faulting module ucrtbase.dll, offset +0xa527e - 40 occurrences in 30 days. My occurrences cluster right after boot and at process termination (including when the process is killed), rather than during a WMIC call, so it may or may not be the same defect. Flagging it only because the signature matches exactly. I can open a separate issue with the full WER dump if that is useful.