XPC is not asynchronous; that's up to the individual caller. The synchronous methods are easier to debug for sure.
XPC is not asynchronous; that's up to the individual caller. The synchronous methods are easier to debug for sure.
It's been some time since I dug into the internals of XPC, but my assumption was that the underlying protocol is asynchronous, and if you do sync calls the wrappers just do the waiting for you.
The problem is that it has a tendency to get stuck in some rare cases, where services just don't reply for some reason. Then the sync calls are the worst -- the UI of the app is completely frozen and there's nothing you can do except restart the app. If the problem is with an Apple service (like Apple ID) then the only way to fix it is to restart the Mac and hope it doesn't happen again.
You don’t seem to have a full grip on the reasons for the intermittent hangs you’re experiencing. Can I suggest two things?
1 Grab a sysdiagnose during one of the hangs and file a feedback report with Apple
2 Use the `sample` command line tool to see what’s actually hanging a particular process for yourself
I try to report all of the issues I see to Apple, but at some point there's nothing I can do except complain that Apple's frameworks are buggy.
The biggest problem with these bugs is that customers always seem to think it's an app bug, and there's nothing the app developer can do except hope that Apple fixes the issue. One early sandbox bug took Apple about 3 years to fix. To be honest I don't even know if they fixed it, it was never mentioned in a changelist, it's just that I stopped getting reports of the issue at some point.
That's interesting! I thought XPC was a wrapper around async mach messages. Do you have any pointers where I can learn more about this?
But it's a special wait that the scheduler and other systems know how to benefit from using vouchers/turnstiles/etc. If you look at spindump output you should see it.
Don't use "sample" if the issue could be multi-process or in the kernel, use "spindump".