AudioUnit (AUv3) Instrument crashing with "viewServiceDidTerminateWithError"

Hi, I’ve encountered a strange problem during iOS AUv3 Instrument development which I’m having trouble finding information on. I’ve spent a few days attempting to debug this, and I was wondering if anyone else has encountered it. It feels more like an "OS killed the app" than a crash, so I use the term crash loosely. Here are the symptoms:


  • The “crash” is inconsistent. Like a lot of slippery bugs, it’ll start happening consistently and then it’ll stop happening completely.
  • When it does happen, it initially appears to load fine: the view loads and looks correct, and it produces audio. But, after a couple seconds, the plugin view disappears and it stops producing audio. I see this in the console log:

viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

  • You don’t have to generate any MIDI events to crash it. It would crash even after I commented out the processing block.
  • It seems to crash when restoring a saved session that uses the plugin. But, if I comment out setFullState, it still crashes.
  • I stripped the project bare so that it only had a blank “Hello, World” view controller and a white noise generator, and it would still crash sometimes with the same symptoms. I was still linking in the same sizable Framework (the plugin is based on a big wad of legacy code), but it is not called. It uses 4.5MB of memory according to the debugger.
  • There are no crash logs generated
  • When debugging, it goes from “no debug session” to “waiting to attach” after it crashes-- at no point does it actually attach. It will attach if I then reload the plugin, but then it won’t crash. The Zombies and Leaks tools didn't reveal anything, nor did the memory sanitizers.
  • didReceiveMemoryWarning is not tripped. In fact, I did an experiment where I allocated 100 megs and memset’d it on startup, and it didn’t crash it.


Here are some differences between how I’m doing it and how the Instrument example program works. Could any of these be an issue?

  • I am using a XIB and not a storyboard
  • It’s in Obj-C, not Swift, and it does not use ARC
  • The framework does not have “Allow app extension API only” checked, but I do not use the routines which call illegal APIs. I did try explicitly using an illegal funcion (getting the shared application’s window), and it didn’t crash, so I expect this wouldn’t be it. Fixing this would be a substantial amount of work, so it's not an easy experiment to try.


If anyone has any ideas, including how to get some useful debugging info out of this situation, let me know!

Replies

I've made a very basic example project which exhibits the problem:

https://drive.google.com/open?id=1dw3xTHn3qY411eXLaIb_9_S5PAtrr5Nk


It's a blank white screen which continually produces white noise. To trigger the bug, save a session in your host with the plugin and then reload it. I don't think it typically happens with a fresh instantiation.


Any takers?

Hi I have what sounds like the exact same issue as you - the instrument loads and after a second, it crashes.


I get the same viewServiceDidTerminateWithError in the console, as well as "Connection to plugin invalidated while in use." and "Connection to plugin interrupted while in use.". It also doesn't attatch to the debug session. It will work fine after reloading or creating a new instance.


Did you manage to find any solutions to this?