Skip to content

macOS clipboard stays stale after vdagent crash because KeepAlive.Crashed is false #3

Description

@elpinguinofrio

Summary

On a macOS guest, clipboard sharing became permanently stuck on stale content after the per-user spice-vdagent process crashed once. The agent did not restart automatically. Manually kickstarting the LaunchAgent immediately restored host-to-guest clipboard updates.

Both macOS plists currently set:

<key>KeepAlive</key>
<dict>
    <key>Crashed</key>
    <false/>
</dict>

According to launchd.plist(5), Crashed=true restarts a job after a crash signal such as SIGSEGV; false restarts it only in the inverse condition. Consequently, a single crash leaves the clipboard agent stopped indefinitely.

Environment

  • macOS guest: 15.7.3 (24G419), arm64
  • Virtual machine: Apple Virtualization backend (Apple Virtual Machine 1)
  • Guest tools package: com.redhat.spice.vdagent 0.22.1
  • Installed plist matches the current repository version

The host UTM version was not available from inside the guest, but the issue is in the guest LaunchAgent policy and the installed package matches this repository's latest release.

Observed evidence

After clipboard synchronization stopped:

$ launchctl print gui/501/com.redhat.spice.vdagent
state = not running
runs = 1
successive crashes = 1
last terminating signal = Segmentation fault: 11

At the same time:

  • spice-vdagentd was running.
  • /dev/tty.com.redhat.spice.0 existed.
  • /var/run/spice-vdagent-sock existed.
  • The local macOS pasteboard service was running.

Restarting the user agent:

launchctl kickstart -k gui/$(id -u)/com.redhat.spice.vdagent

produced:

state = running
runs = 2

While copying fresh text on the host, the guest NSPasteboard.changeCount then changed from 358 to 359, and the new host text pasted successfully in the guest. This rules out the host clipboard setting, virtio channel, and guest pasteboard as the persistent failure.

The original agent crash trigger was not recovered because no .ips crash report was generated. This issue is specifically about the deterministic failure to recover after any crash.

Likely regression

Commit c729770 ("darwin: fix launch scripts") changed Crashed from true to false in both:

That appears to invert the intended restart behavior. The daemon is exposed to the same permanent-stop failure if it crashes.

Expected behavior

If spice-vdagent or spice-vdagentd crashes, launchd should restart it (with appropriate throttling) so clipboard sharing recovers without requiring a VM reboot or manual launchctl kickstart.

Suggested fix

Restore <true/> for KeepAlive.Crashed in both macOS plists, or add another supervised recovery mechanism if avoiding an unbounded crash loop is the reason for the current setting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions