Placeholder-Software / Dissonance

Unity Voice Chat Asset
71 stars 5 forks source link

Error: Cannot associate preprocessor with Playback filter - one already exists! #214

Closed martindevans closed 3 years ago

martindevans commented 3 years ago

Sometimes this error occurs:

"BasePreprocessingPipeline: Error: Unhandled exception killed audio preprocessor thread: Dissonance.DissonanceException: Error: Cannot associate preprocessor with Playback filter - one already exists! This is probably a bug in Dissonance, we're sorry! Please report the bug on the issue tracker "https://github.com/Placeholder-Software/Dissonance/issues". You could also seek help on the community at "http://placeholder-software.co.uk/dissonance/community" to get help for a temporary workaround. Error ID: D5862DD2-B44E-4605-8D1C-29DD2C72A70C"

A reliable reproduction seems to be this: https://discord.com/channels/631607020310495232/631607497760702483/785620817459281961

martindevans commented 3 years ago

For this to happen Script Changes While Playing must be set to Recompile And Continue Playing.

martindevans commented 3 years ago

Dissonance 7.2.0 was just approved by Unity and is now live on the asset store. That includes a partial fix for this issue.

The root cause was scripts reloading while playing, which throws away all runtime state of the scripts. Dissonance is not designed for this and does not support it. One particular bit of state is a piece of global configuration in the native audio system code - because the state is thrown away this is never explicitly cleaned up and because it's native code the GC doesn't clean it up either. Previously Dissonance was detecting this memory leak and throwing the Cannot associate preprocessor with Playback filter... error. Now Dissonance should detect the domain reload and clean up the state before it is throw away.

This does not add full support for domain reloads to Dissonance and they are still not supported. However it should fix this one particularly annoying issue (which required a full editor restart to fix).