iPhone Simulator does not close opened files, leading to maxfiles issues and unusable system

Originator:steipete
Number:rdar://33214489 Date Originated:10-Jul-2017 06:51 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8.3.3 / macOS 10.12.5
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
We’ve seen fork issues in our CI and started investigating what’s wrong here.

The open files on one of the machines with `lsof -u ci` shows about 70k lines of `/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS X.X.simruntime/Contents/Resources/RuntimeRoot/X`. A newly restarted machine doesn’t have any of those lines.


Steps to Reproduce:
`killall Simulator` and `killall com.apple.CoreSimulator.CoreSimulatorService` doesn’t remove those open files.

Expected Results:
Killing the Simulator should clean up all files opened by it.

Actual Results:
`lsof -a -u ci +D /Library/Developer/CoreSimulator/Profiles/Runtimes | wc -l` returns 75033. This all looks way too much.

Version:
Xcode 8.3.3 / macOS 10.12.5

Notes:
`lsof -a -u ci +D /Library/Developer/CoreSimulator/Profiles/Runtimes -t | xargs kill -9` kills all of these processes. Will put that in the clean up script for now but this is a bug that should be fixed on the Simulator side. Many other people will run into that. We also increased the maxfiles limit of all machines from 512 to 65536 and added the above line to our clean up script.

Sysdiagnose of our CI is attached

Comments


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!