Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install! triggers: Mach error -308 - (ipc/mig) server died #7

Open
garriguv opened this issue Dec 2, 2016 · 11 comments
Open

install! triggers: Mach error -308 - (ipc/mig) server died #7

garriguv opened this issue Dec 2, 2016 · 11 comments

Comments

@garriguv
Copy link
Contributor

garriguv commented Dec 2, 2016

Hi Johannes,

We're seeing a quite frequent problem when trying to install apps in the simulator and I'm wondering if you've ever encountered it:

We're running the following command to start the simulator and install the app:

# launch the simulator
@device.launch!
@device.wait! {|d| d.state == :booted}

# install the app
@device.install!(@app_path)

Quite often, the install! step fails and we get the following output:

An error was encountered processing the command (domain=NSMachErrorDomain, code=-308):
The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died)
(StandardError)

I found this thread on the dev forums https://forums.developer.apple.com/message/70514#70514

That lead me to these crash reports: https://gist.github.com/garriguv/d6a35a39ec87e33254917948c130d357

Not super helpful but I've filed a radar.

I've had to add a pretty long sleep before trying to install the app. That reduces the occurrences but it obviously not optimal...

@plu
Copy link
Owner

plu commented Dec 2, 2016

Hey Vincent,

we were not using the install! command of simctl at all, so we never ran into this issue. From a first glance at your crash log and the error message I must admit that I don't have any idea what might be causing this, sorry!

In the crash log I noticed that the path to your Xcode is /Applications/Xcode-8.1.app. I assume it's one of your CI nodes, right? Are your jobs using different versions of Xcode? Is it possible that there are still some processes of the Simulator running from a previous job execution, that got launched by Xcode 8.1 and the next job will be using a different version of Xcode?

@garriguv
Copy link
Contributor Author

garriguv commented Dec 2, 2016

We did have that issue in the past when we migrated from 8.0 to 8.1. It ended up throwing different errors. I don't think this is related.

I submitted the radar this morning, I'll see if I hear back from Apple. This is causing us a lot of problems so I'm considering using one of our technical support incidents.

In the meantime, this is the code we're using:

begin
  @device.install!(@app_path)
rescue StandardError => e
  sleep(5)
  @device.install!(@app_path)
end

If you're not using the install! command, how are you installing your app on the simulators?

@plu
Copy link
Owner

plu commented Dec 2, 2016

Sorry I couldn't help here!

@plu
Copy link
Owner

plu commented Dec 28, 2016

I just pushed some changes (7e33c03) to master that might help you:

@device.launch
@device.wait(90) {|d| d.state == :booted && d.ready? }
@device.install(@app_path)

The 90 here is not the waiting time, it's the timeout. If you're curious what it does: It checks for a list of (launchd) processes that belong to the Simulator, which are supposed to define some readiness. Similar to what FBSimulatorControl does. Right now this will only work for iPhone/iPad Simulators should now also work for these, but didn't test properly.

@plu
Copy link
Owner

plu commented Dec 30, 2016

If you're not using the install! command, how are you installing your app on the simulators?

Sorry, I completely missed this question!

We're using pxctest on our CI.

@garriguv
Copy link
Contributor Author

I'm on vacation this week but I'll try the command when I'm back next Monday.

I did see some tweets (from you I believe?) mentioning the technique Facebook uses in xctool. It's really nice that you implemented it. Thank you!

@plu
Copy link
Owner

plu commented Dec 30, 2016

You're welcome - I hope it resolves your issues.

Enjoy your vacation :)!

@michaellady
Copy link

michaellady commented May 25, 2017

@plu when should the required_services_for_ready be present? when the simulator is fully booted? I do not see those services at all when my sim is fully booted and running tests

I'm not running simctl, just emulating some of its behavior in my own build script

EDIT: I wasn't running the launchctl in the simulator, just on my mac. oops

@michaellady
Copy link

@plu , so this commit waits until the following state is finished?

screen shot 2017-05-26 at 7 36 33 pm

@justinseanmartin
Copy link

justinseanmartin commented Jun 12, 2017

We're seeing the same error mode now on upgrading from Xcode 8.2.x to 8.3.x. I'm presuming that this might be caused by the set of services that are being waited on for the simulator to be considered ready? In the CoreSimulator logs, we're getting errors with:

CoreSimulatorBridge[67683]: Error in registering callback port Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Port is invalid., NSLocalizedDescription=Unable to register pasteboard callback port.}

We're using the suggestion above with the:

timeout = 240
device = SimCtl.device(udid: device_id)
device.boot
device.wait(timeout) { |d| d.state == :booted && d.ready? }

Any ideas?

@justinseanmartin
Copy link

Also, I noticed we're using boot versus launch, but I'm not sure if there is something substantially different between the two.

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

No branches or pull requests

4 participants