cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.67k stars 103 forks source link

macOS UI tests trigger crash in VM #702

Closed amonshiz closed 6 months ago

amonshiz commented 6 months ago

We have been testing running macOS UI tests within VMs since Ventura 13.5 but faced crashes within a Virtualization.framework thread. The crash is not at a consistent point in our test plan so it is difficult to narrow down what is causing it. Further, there is no crash report on the guest VM. There is a host side crash stack which is attached. Below is the command to run the VM and the error that is printed to the terminal:

; tart run sonoma-14.2.1-local-developer --dir="arc:~/Developer/browser-swift/Stage/DerivedData"
guest has stopped the virtual machine due to error: Error Domain=VZErrorDomain Code=1 "The virtual machine stopped unexpectedly." UserInfo={NSLocalizedFailure=Internal Virtualization error., NSLocalizedFailureReason=The virtual machine stopped unexpectedly.}

com.apple.Virtualization.VirtualMachine-2024-01-12-174529.ips.zip

If there are additional logs I can provide from tart itself I would be more than happy!

We generated the above VM originally with Ventura 13.5.1. It would crash when the UI tests were run within it so I waited for Sonoma and just tested again on 14.2.1 where it still crashes, seemingly with the same bug.

fkorotkov commented 6 months ago

Hey @amonshiz, could you please elaborate on what kind of UI tests are you running? There was one time where we had iOS simulator in the guest that was trying to use Metal APIs to crash paravirtualized GPU and the VM itself. It's been reported as FB10025528 back in May 2022, there were some responses from Apple but then it went stale. But it doesn't seem like the case here probably.

From the crash report I noticed that it seems guest is actively swapping memory. Have you tried to give the VM more memory and maybe CPUs? We had a customer of Cirrus Runners struggling with crashes (not the whole VM but some processes within it) due to lack of CPU/memory so we introduced XL runners and it solved the issue.

fkorotkov commented 6 months ago

Closing due to lack of reponse.