Skip to content

Fix P0 issues: vanishing bottles, runtime install, log growth, CPU spin - #3

Merged
iStorry merged 4 commits into
mainfrom
fix/p0-issues
Oct 29, 2026
Merged

iStorry merged 4 commits into
mainfrom
fix/p0-issues

Conversation

@iStorry

@iStorry iStorry commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Fixes the P0 groups from docs/upstream-issue-triage.md that are in Whisky's own code, and moves the WhiskyWine runtime to this repository because upstream's host is gone.

Why

data.getwhisky.app/Wine/Libraries.tar.gz and its version file now return 404. Setup saved the 404 page as the download, extracting it failed silently, setup still reported success, and with no Wine installed every new bottle removed itself without a message. Most of the "bottles disappear" reports trace back to that chain of silent failures.

What changed

100% CPU (Whisky-App#1010, Whisky-App#1031)

  • Clear each pipe's readability handler at end of file. Foundation keeps calling it on a closed pipe, so every finished process left a reader spinning a full core. A standalone copy of the old pattern used 1.00s of CPU per idle second; the fix uses 0.00s.
  • Finish the output stream once the process has exited and both pipes have closed, instead of blocking the termination handler in readToEnd() while child processes still hold the pipes.

Logs filling the disk (Whisky-App#1005, Whisky-App#1115, Whisky-App#1261)

  • Each process log stops at 100 MB with one truncation notice.
  • Logs older than 7 days are deleted, then the oldest until the folder fits in 1 GB.
  • Log file names are unique, so two runs in the same second no longer share and truncate one file.

WhiskyWine download and install (Whisky-App#801, Whisky-App#995, Whisky-App#1020, Whisky-App#1271, Whisky-App#1275)

  • Non-200 responses are rejected, and the download is moved out of URLSession's temporary location before the completion handler returns.
  • The archive is extracted into a staging folder, and Libraries is replaced only once the new runtime has a version file. tar failures are no longer ignored.
  • Download and install failures show the error with a Retry button.
  • Updating no longer uninstalls the working runtime before the new one has downloaded.

Bottle creation (Whisky-App#359, Whisky-App#760, Whisky-App#819, Whisky-App#1237, Whisky-App#1364 and duplicates)

  • A failed bottle shows an alert with the reason: WhiskyWine missing, a folder name ending in a period (Wine drops trailing dots when mapping paths), or Wine not creating the prefix, with Wine's output.
  • The half-created bottle folder is removed on failure.
  • Bottles still being created survive list reloads.
  • Creation runs on the main actor instead of changing published state from a detached task.
  • An unreadable bottle list is moved aside instead of being overwritten with an empty list.

Runtime hosting

  • The app downloads Libraries.tar.gz and WhiskyWineVersion.plist from the whiskywine release of this repository. WhiskyWine 2.5.0 is already published there.
  • scripts/publish-whiskywine.sh packages a built Libraries folder and replaces both assets.
  • The published runtime is upstream's last archive (24 Aug 2025), taken from the Internet Archive. It matches the Archive's recorded SHA-1, and the re-packed upload unpacks to identical files, modes and symlinks.

Workflows

  • Removed Release.yml. It posted to upstream's Discord and bumped the Whisky-App Homebrew cask, and it ran on every published release, including the runtime release.
  • CI now runs swift test for WhiskyKit.

Testing

  • New WhiskyKit tests: log capping and pruning, download validation, staged install and rollback, process stream completion, children holding pipes open, and an idle-CPU regression test. 15 tests pass.
  • SwiftLint --strict is clean, and the Whisky and WhiskyCmd schemes build with no warnings.
  • Not tested in the running app yet: first-run setup with the published runtime, and creating a bottle.

Not fixed here

For reviewers

  • Info.plist still points Sparkle at upstream's appcast (data.getwhisky.app/appcast.xml), so this build would be offered upstream's app updates.
  • New strings are English only.

Process output (Whisky-App#1010, Whisky-App#1031)
- Clear each pipe's readability handler at end of file. Foundation keeps
  calling it on a closed pipe, so every finished process left a reader
  spinning a full core for the life of the app.
- Finish the stream once the process exited and both pipes closed instead
  of blocking the termination handler in readToEnd() while children such
  as a game started by `wine start` still hold the pipes.

Logs (Whisky-App#1005, Whisky-App#1115, Whisky-App#1261)
- Cap each process log at 100 MB with a single truncation notice.
- Prune logs older than 7 days, then the oldest until the folder fits in
  1 GB. Log names are unique so runs in the same second no longer share
  and truncate one file.

WhiskyWine download and install (Whisky-App#801, Whisky-App#995, Whisky-App#1020, Whisky-App#1271, Whisky-App#1275)
- Reject non-200 responses and move the download out of URLSession's
  temporary location before the completion handler returns.
- Extract into a staging folder and replace Libraries only once the new
  runtime has a version file; tar failures are no longer ignored.
- Show download and install failures with Retry instead of stalling or
  reporting success.
- Updating no longer uninstalls the runtime before the new one downloads.

Bottle creation (Whisky-App#359, Whisky-App#760, Whisky-App#798, Whisky-App#819, Whisky-App#1029, Whisky-App#1079, Whisky-App#1110, Whisky-App#1191,
Whisky-App#1232, Whisky-App#1237, Whisky-App#1278, Whisky-App#1306, Whisky-App#1311, Whisky-App#1364)
- Report why a bottle could not be created instead of silently removing
  it: WhiskyWine missing, a folder name ending in a period, or Wine not
  creating the prefix (with Wine's output).
- Remove the half-created bottle folder on failure.
- Keep bottles that are still being created across list reloads.
- Run creation on the main actor rather than mutating published state
  from a detached task.
- Set aside an unreadable bottle list instead of overwriting it with an
  empty one.

Tests
- Add a WhiskyKit test target covering log capping and pruning, download
  validation, staged installs, and process stream completion and idling.
  Run it in CI.
data.getwhisky.app no longer serves the runtime (both the archive and the
version file return 404), so setup could never install WhiskyWine.

- Download Libraries.tar.gz and WhiskyWineVersion.plist from the assets
  of the whiskywine release.
- Add scripts/publish-whiskywine.sh, which packages a built Libraries
  folder and uploads both assets, replacing the previous runtime.
- Skip the Discord and Homebrew release job for the whiskywine release,
  which is not an app release.
This checkout also has the upstream remote and no gh default repository,
so release commands without --repo could target the wrong repository.
It announced releases on upstream's Discord and bumped the Whisky-App
Homebrew cask. Neither applies to this fork while it is being built, and
it ran on every published release, including the whiskywine runtime.
@iStorry
iStorry merged commit 0e52ede into main Oct 29, 2026
1 check passed
@iStorry
iStorry deleted the fix/p0-issues branch October 29, 2026 04:21
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