Skip to content

infra: macOS DMG packaging aborts when the first hdiutil detach hits 'Resource busy' #2728

Closed

Description

@zackees

What happened

release-rust.yaml -f verify_only=true on master fc0352611 (run 40627344990, 2026-10-28 03:33Z) failed in Build macos arm64 🧱 → step Package OBS-Studio-Rust 📀 (job 122615438598), not in the build:

03:46:34.528  created: .../build_macos/temp.dmg
03:46:34.815  /dev/disk33s1  Apple_HFS  /Volumes/obs-studio-33.0.0-beta6-fc0352611-macos-apple
03:46:49.430  hdiutil: couldn't eject "disk33" - Resource busy
03:46:49.436  ##[warning] Unable to run 'hdiutil detach /Volumes/obs-studio-33.0.0-beta6-...-macos-apple' (attempt #1). Retrying.
03:46:51.737  hdiutil: detach failed - No such file or directory
...           (attempts #2..#5, all "No such file or directory")
03:47:52.337  ##[error] Unable to run 'hdiutil detach /Volumes/...'. Aborting
03:47:52.794  ##[error] Disk image creation failed.

Compilation, codesign and the .app bundle all succeeded; the job dies in DMG packaging. The same job passed on b926b01c4 (40529110726), so this is intermittent — and it aborts the release instead of retrying.

Cause: the retry re-uses a mountpoint that no longer exists

.github/scripts/utils.zsh/create_diskimage:

  • line 71 — safe_hdiutil detach /Volumes/${output_name}
  • lines 21-42 — safe_hdiutil retries the same argv five times (_backoff=(2 5 10 15 30)), then gives up.

Attempt #1 fails with Resource busy (something still holds the volume: XProtect/mds/Finder). A partially-ejected volume then removes the mountpoint, so attempts #2-#5 do not retry the detach at all — hdiutil detach <path> fails while resolving the path (No such file or directory), which is the desired end state, not an error. The loop can therefore only fail once the first attempt hits Resource busy, and the ERR/abort path reports it as "Disk image creation failed".

Fix

Detach through a dedicated function that:

  1. returns success when the mountpoint is already gone ([[ ! -d ${mount_point} ]]) — that is what attempts docs: Rust port testing policy #2-Phase 2: finish existing cmocka suite (os_path, serializer, darray) + CI + Windows/macOS Tier 2 #5 were seeing;
  2. resolves the device node once (hdiutil info) and retries the device (hdiutil detach /dev/disk33), which survives the mountpoint disappearing;
  3. keeps the existing backoff and the XProtect kill;
  4. ends with one hdiutil detach -force as a last resort before aborting.

Offline pin (ci/test_*.py, no macOS needed): the detach site uses the volume helper, and the helper keeps the already-unmounted early return, the hdiutil info device lookup and the -force last resort — so a later edit cannot quietly restore the stale-path retry.

Scope / not claimed

  • Intermittent: one occurrence on master, one pass on the previous head. I did not measure the flake rate.
  • hdiutil: couldn't eject - Resource busy is a runner condition; the defect here is that packaging treats it as fatal.

Activity

  1. added
    infra
    on Oct 28, 2026
  2. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Claiming: investigation — reproduce the failure shape locally against the script's logic, then fix the retry and pin it offline in one PR (RED: a ci test that fails on master; GREEN: the helper in create_diskimage).

  3. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    /ready

    Self-filed from a real master failure (run 40627344990): scope is one function in .github/scripts/utils.zsh/create_diskimage, acceptance is "packaging no longer aborts when the first detach is Resource busy", and the pin is an offline ci test, so no macOS runner is needed to verify it.

  4. added
    needs-investigation
    on Oct 28, 2026
  5. added
    ready
    and removed
    needs-investigation
    on Oct 28, 2026
  6. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Claiming: dmg detach retry — PR #2729 (RED b00b1dd7a / GREEN 483f04069). The helper now retries the device node and treats an already-unmounted volume as success; the offline pin fails on master and passes here. Waiting on PR CI and a real macOS package run for the end-to-end evidence.

  7. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Fixed by #2729 (merged 2026-10-28 04:18 UTC as 25fc4bc6e).

    What changed in .github/scripts/utils.zsh/create_diskimage:

    • safe_hdiutil retries the device node (/dev/diskN) that hdiutil info reports for the mounted volume, instead of the /Volumes/<name> path the first attempt may already have removed.
    • An already-unmounted volume (no mount point left for the image) counts as success, so a partially ejected volume no longer turns into five "No such file or directory" retries and an abort.
    • ERR/abort only fires when the volume really is still mounted.

    Evidence:

    • Offline pin: ci/test_diskimage_detach.py (RED b00b1dd7a on master, GREEN 483f04069), part of ./lint.
    • End-to-end on macOS: release-rust.yaml -f verify_only=true run 40631862829 on master 25fc4bc6e finished green with zero failed jobs, including both Build macos arm64/x86_64 🧱 DMG packaging and both Native macOS … DMG startup 🧪 smokes. That run is the "real macOS package run" this issue was waiting for.

    Nothing is left from this issue; the daily beta publication is tracked separately in #2725.

  8. moved this from In progress to Done in obs-rust Multiviewon Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions