Skip to content

Fix workshop download hanging on "Requesting download..." on macOS - #2

Open
clspeter wants to merge 1 commit into
Unayung:mainfrom
clspeter:fix/download-hang-macos
Open

Fix workshop download hanging on "Requesting download..." on macOS#2
clspeter wants to merge 1 commit into
Unayung:mainfrom
clspeter:fix/download-hang-macos

Conversation

@clspeter

Copy link
Copy Markdown

Problem

On macOS, steamcmd frequently hangs after a workshop download completes instead of exiting on +quit — a thread-race during Steam API teardown (the same Unexpected thread race for CIOPollingHelper / work processing queue not empty messages steamcmd prints on shutdown).

Because downloadWorkshopItem() waits on process.waitUntilExit() with no bound, the app stays stuck on "Requesting download..." forever, even though the item is already fully downloaded to steamapps/workshop/content/431960/<id>/. The download never gets copied into the library and the UI never recovers.

Fix

Two changes, both scoped to downloadWorkshopItem() in SteamCmdService.swift:

  1. Terminate steamcmd once the download is done. The real-time output handler now watches for steamcmd's success line (Downloaded item) and calls process.terminate() itself. The files are already on disk at that point, so the existing "copy to library" logic (which keys off file existence, not exit code) proceeds normally.
  2. Bound the exit wait. The blocking process.waitUntilExit() is wrapped in a DispatchGroup timeout backstop — mirroring the pattern already used in runSteamCmd() — so a process that stalls before printing success (e.g. a network hang) can't block the download indefinitely either.

Testing

  • Reproduced the hang downloading item 827148653: workshop_log.txt showed Download item 827148653 result : OK / Finished Workshop download job : No Error, but the steamcmd process never exited and the UI stayed on "Requesting download...".
  • After the fix, xcodebuild -scheme "Open Wallpaper Engine" buildBUILD SUCCEEDED.

🤖 Generated with Claude Code

steamcmd frequently hangs after a workshop download completes instead of
exiting on +quit (thread-race during Steam API teardown on macOS), leaving
downloadWorkshopItem() blocked forever on waitUntilExit() and the UI stuck
on "Requesting download...".

Detect the success line and terminate steamcmd ourselves once the files are
on disk, then bound the exit wait with a timeout backstop (mirroring
runSteamCmd) so a process that stalls before printing success can't block
the download indefinitely.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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