xcodebuild hangs when a test causes EXC_BAD_ACCESS kernel exception

Number:rdar://24222858 Date Originated:1/17/2016
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
My team and I write a lot of tests, and we always have a CI server running that will run our tests after each commit. Lately, as the team has grown, we've been seeing more EXC_BAD_ACCESS kernel exceptions, and we've been trying to track them down.

Unfortunately, it's hard to find the cause, because when this happens the xcodebuild command line stops writing to STDOUT and appears to hang indefinitely. This is quite frustrating because we then need to reset our xcode build server and identify what happened.

Note: this occurs regardless of whether "Debug executable" is selected for the application under test, or the test bundle.

Steps to Reproduce:
1. Install Xcode 7.2 (possibly earlier builds)
2. git clone https://github.com/tjarratt/DemonstrateXcodeHang
3. cd DemonstrateXcodeHang
4. xcodebuild test -scheme DemonstrateXcodeHang -destination platform=iOS Simulator,name=iPhone 6,OS=9.1
5. Wait for the one test to finish

Expected Results:
The test should finish and indicate something horrible happened.

I do not expect the entire test suite to finish, or even explain exactly what did occur, just for it to halt at some point. 

Actual Results:
The xcodebuild process hangs forever.

Xcode Version 7.2 (7C68)

OS X 10.11.2 (15C50)

For an example of this, please see this github repository


This occurs on all hardware I've tested this on, with Xcode 7.2. Earlier releases of Xcode may be affected as well.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!