Xcode exit code 65

xcode

#1

A number of customers reported an issue with Xcode 7.3 where the xcodebuild command would fail without any error message and would return the exit code 65 to the console:

▸ Running script 'Embed Pods Frameworks'
▸ Running script 'Copy Pods Resources'
▸ Touching SampleTests.xctest
** TEST FAILED **


command xcodebuild test -workspace 'SampleTests.xcworkspace' -scheme SampleTests -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 6s' | xcpretty returned exit code 65

It is currently not clear what exactly is causing the issue, and we are investigating the problem, trying out possible solutions and testing them with a set of sample projects.

We appreciate your patience while we work on the issue. We will continue to update this thread with any advances in the investigation.


#2

Hello. what is the status of this issue? We are getting hit by it hard recently. An example of failed builds sequence, eventually fixed by stubborn Rebuilding:
https://circleci.com/gh/kitt-browser/kitt/466
timed out in 467, success in 468
Thank you


#3

In our case the issue was solved using fastlane scan in place of the regular test phase.


#4

Please give us an update on this. So many of our builds are failing as a result, racking up our Circle CI bill.


#5

Any update, Circle? This is really a problem for us.


#6

We’re also seeing a majority of our builds fail under this same condition. Even after using Fastlane’s Scan we see the same result.


#7

We are also experiencing this error when using fastlane scan.


#8

Any update?


#9

Please contact support about this and we’ll credit you for minutes used on these exit 65 failures. We’re still investigating the cause of these flakey failures, but we don’t want you paying extra for them.


#10

Hey all,

I understand this must be terribly frustrating. We have people spending time trying to diagnose this (and have been looking at this for awhile unfortunately). It appears that Error Code 65 is a more generic error code which makes this diagnosis harder as it likely pertains to several possibly unrelated topics.

In our research, we’ve found that it appears to hit many OS X platforms (including complements and competitors). Because it’s increasingly common, we have tried to diagnose if hosting has a common cause. It appears to have started happening more since the last version of XCode as well. We feel a similar frustration ourselves as we continue to try and solve this.

My team recently shipped a change such that

  1. you won’t be charged for the minutes spent where a build fails due to Error Code 65

  2. We will auto-retry that build for you up to 3x (as we’ve seen repeatedly this bug can be intermittent).

It doesn’t solve the issue (I wish we could do that as easily!) but I hope it shows a sign of respect for your situation. Thanks for being CircleCI customers.


#11

Is there a way to determine how many minutes were credited back due to Error Code 65? I burned through a ton of builds trying to diagnose and fix this issue over the last month.

One thing I have learned that might shed some light, my issues seem related to the tee command that Fastlane scan emits as part of the build step.

Fastlane scan emits this:

set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./the_workspace.xcworkspace -scheme 'the_scheme' -configuration 'Test' -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 5s' -enableCodeCoverage YES build test | tee '/Users/distiller/Library/Logs/scan/App-log.log' | xcpretty

If I execute this command directly as part of my circle.yml file it will still fail as described in this thread but both Fastlane and this command run fine on my team’s local machines.

Dropping the tee command allows it to succeed reliably on Circle.

Here is the command I’m currently using in my circle.yml file:

test:
  override:
    - set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace './the_workspace.xcworkspace' -scheme 'the_scheme' -configuration 'Test' -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 5s' -enableCodeCoverage YES build test | xcpretty

#12

Is there any followup for this issue? I’m continuing to get seemingly random build/test failures with error code 65 and it’s very frustrating to have to keep rebuilding until it works.


#13

Nothing definite yet but our mobile team has isolated some really promising root causes and we’re testing possible solutions with 1-2 alpha customers now. As soon as we have it solved, we will update.

Thanks for your understanding! Xcode is tricky…


#14

EDIT Jan 16 2017: We no longer recommend using UUIDs to start simulators. The OS X image has been updated to resolve the underlying issue, and using UUIDs is no longer necessary. Please check out this post for examples of how to choose the simulators by name.

Hey everyone,

this issue is for most people very likely caused by a timeout because the iOS simulator not starting fast enough.

A workaround that has been tested by us is starting the GUI simulator first with:

- xcrun instruments -w 'Select a iOS Simulator UUID' || true
- sleep 15

This is a list of possible iOS Simulator UUIDs you can use:

iPad 2 (8.4) [A4276BA9-2D38-434D-A063-A1A7DC399235] (Simulator)
iPad 2 (9.0) [2F39BEF2-E92D-498C-B2D9-29366BD8F732] (Simulator)
iPad 2 (9.3) [101B434D-924B-4C7E-B8C1-ED8B376BF7CA] (Simulator)
iPad Air (8.4) [AD005E41-F7E6-4C5F-B3B1-6C980E834739] (Simulator)
iPad Air (9.0) [42D87249-99F2-4BC1-9180-317D268C46F7] (Simulator)
iPad Air (9.3) [72F9B9E8-DC05-4450-B030-407D4B0968D9] (Simulator)
iPad Air 2 (9.0) [6E2B1E19-6466-4328-917C-16019130FDE8] (Simulator)
iPad Air 2 (9.3) [A141F49D-F20A-49B3-ACBF-A97F9FFB9B89] (Simulator)
iPad Retina (8.4) [399AEF36-5560-4C4A-AE61-03F0A81555D0] (Simulator)
iPad Retina (9.0) [A1EC86BA-49AB-414B-9C27-2D0F26A34A81] (Simulator)
iPad Retina (9.3) [A70FE3C7-756F-44BF-BE46-68663FAE2EE3] (Simulator)
iPhone 4s (8.4) [F2E9EEAB-9FCE-4109-A40F-3DD79627C985] (Simulator)
iPhone 4s (9.0) [5EF3DECC-3E8F-41A0-B2CF-DC384A66E12E] (Simulator)
iPhone 4s (9.3) [8538CCCC-80FB-4B6B-9281-222771C38FEB] (Simulator)
iPhone 5 (8.4) [C5C8EA0E-F5A8-4AF8-BBAA-385B61026A5E] (Simulator)
iPhone 5 (9.0) [24F6F5A0-343E-4C64-9F4C-B50D88F5E99E] (Simulator)
iPhone 5 (9.3) [075FB8BA-F088-4A16-89CF-4EA36BC25E7A] (Simulator)
iPhone 5s (8.4) [45BFA4E8-C0A9-4A04-9CD0-4449FE4CF40B] (Simulator)
iPhone 5s (9.0) [49DAC9E5-C129-497D-853E-D93BC4BB8A10] (Simulator)
iPhone 5s (9.3) [3011ED5C-C63A-42E6-9D91-82A39DE4AD06] (Simulator)
iPhone 6 (8.4) [65AAA024-64D5-40B9-A122-8872E3F52EC4] (Simulator)
iPhone 6 (9.0) [53600017-30F1-428A-A16A-25C6CEDBD849] (Simulator)
iPhone 6 (9.3) [547B1B63-3F66-4E5B-8001-F78F2F1CDEA7] (Simulator)
iPhone 6 Plus (8.4) [DFB14113-4697-4E2D-AD3F-B4FBA4B62969] (Simulator)
iPhone 6 Plus (9.0) [321D1CF5-2514-4897-8B09-C133602F6DB5] (Simulator)
iPhone 6 Plus (9.3) [C63728B8-89B5-4FFB-8B6E-174A2F85B47F] (Simulator)
iPhone 6s (9.0) [763DC427-F2C5-4AA4-989F-2CA944FA8F04] (Simulator)
iPhone 6s (9.3) [E8DD285C-51EE-4DB5-B326-7E927686EC36] (Simulator)
iPhone 6s Plus (9.0) [011805C3-BB7A-4785-A313-D7AD2AF6DE49] (Simulator)
iPhone 6s Plus (9.3) [019CFBB0-0086-44A7-AA41-D39182D9CE01] (Simulator)

If you still run into issues please feel free to send a support request so that I can take a look at your builds and gather more information this way.

Thanks for your patience, I really do hope that this will get rid of red builds for a lot of you!

I’ve submitted a radar to Apple. Feel free to dupe it so that we can get more attention to this issue :slight_smile:

Greetings,
Constantin


The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations
Xcodebuild error : Unable to find destination, returned exit code 70
Exit Code 134 when booting iPhone Simulator
#15

I implemented the fix you recommended @anon47539524 like this:
dependencies: pre: - xcrun instruments -w 'A70FE3C7-756F-44BF-BE46-68663FAE2EE3' || true - sleep 15

And I have still gotten a code 65 error, albeit only one so far.

Do you know, are some simulators faster to load than others?


#16

I get a template-missing error when I try that:

distiller-build-8:~ distiller$ xcrun instruments -w 'A70FE3C7-756F-44BF-BE46-68663FAE2EE3’
2016-07-28 15:34:43.398 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk; its version (7.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.399 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk; its version (8.4) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.399 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk; its version (9.0) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.400 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk; its version (9.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.400 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk; its version (9.2) is below required minimum (9.3) for the iphonesimulator platform.
Waiting for device to boot…
Instruments Usage Error: No template (-t) specified
instruments, version 7.3 (60134)


#18

I just double checked with @anon47539524 it looks like you are actually missing ||true, can you try to run the command like this:

xcrun instruments -w 'A70FE3C7-756F-44BF-BE46-68663FAE2EE3' || true


#19

Hey Geoffrey,

this is indeed an issue with the a template, but simply because we don’t specify one to make it launch quicker. You don’t want to profile your application in any way, you’re simply using xcrun instruments because Instruments is able to launch the GUI iOS simulator reliably (which xcrun simctl isn’t). The Instruments command itself fails, but it launches the iOS simulator anyways. Please add || true at the very end of your command to suppress a non-0 exit code.


#20

Hey,

this might happen. I’ve seen this before, you might be a special case and this fix wont do the job on your project. I’d love to take a look. Please contact our Support and reference this text, so that I can find your ticket.

Constantin


#21

The xcrun instruments trick seems mostly to work for us, with occasional failures that are fixed by retrying. Quite frustrating that there doesn’t seem to be a reliable solution.

EDIT: It looks like the inconsistency may have just been from invoking xcrun instruments with the wrong simulator UUID; builds have been fine since I fixed that.