UI test flakiness due to "Could not register service ...: Failed to lookup ...: 0x44e"

Hi,

under Xcode 14 (even with the newest 14.1) we are experiencing an unprecedented flakiness of our UI tests. On the corresponding screenshots we see that our app freezes on the launch screen.

Looking into the diagnostic logs (collected by xcrun simctl diagnose ...) we see the same pattern around the point of time a UI test fails.

Example:

Test started at 2022-11-03 13:36:42.577

In CoreSimulator.log we see:

Nov  3 13:35:50 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.fpsd.sim: Failed to lookup com.apple.fpsd.sim: 0x44e
Nov  3 13:36:46 [...] CoreSimulatorService[53979] <Warning>: Device DC91E266-BFFD-4F26-933D-B674F1E8DB37 encountered in creation state at launch.  The device will be re-created.
Nov  3 13:36:47 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e
Nov  3 13:36:47 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e
Nov  3 13:36:47 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.fpsd.sim: Failed to lookup com.apple.fpsd.sim: 0x44e
Nov  3 13:36:47 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.fpsd.sim: Failed to lookup com.apple.fpsd.sim: 0x44e
Nov  3 13:36:56 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e
Nov  3 13:36:56 [...] CoreSimulatorService[53979] <Error>: Could not register service com.apple.fpsd.sim: Failed to lookup com.apple.fpsd.sim: 0x44e

Does anybody know what these errors mean? Is there any relation to the flakiness? How can we prevent these errors?

Thanks!

I have similar symptoms in my case:


Dec  6 15:21:57 RS-UNIT-0039 CoreSimulatorService[917] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e
Dec  6 15:23:12 RS-UNIT-0039 CoreSimulatorService[917] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutting Down" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutting Down}
Dec  6 15:23:12 RS-UNIT-0039 CoreSimulatorService[917] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutting Down" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutting Down}
Dec  6 15:23:42 RS-UNIT-0039 CoreSimulatorService[917] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e

Would like to know as well what could be wrong.

Addendum: We observed in the xcresult log that the first UI test fails on the first runner. Subsequent tests then run successfully on the first and other runners. Our workaround is to run a dummy test first that is expected to fail (XCTExpectedFailure...) to avoid breaking our pipeline. This seems to boot up the simulator properly for the subsequent "real" tests.

UI test flakiness due to "Could not register service ...: Failed to lookup ...: 0x44e"
 
 
Q