Open tt2468 opened 2 years ago
Any news on this issue? I think I have a similar problem with my AU plugin on MacOS when running it inside Ableton Live 10 With latest version of asio (asio-1-22-1 ) I get a crash but with a previous version I don't.
I've taken some time today to dive into this and while I haven't been able to find the exact root cause, I did gain some insights:
asio
is added as a header-only library into multiple dynamic libraries which are loaded at runtime (i.e. via dlopen
), duplicate symbols will be resolved in the global address space of the binary loading the libraryobs-studio
this means that whichever dynamic library (a "plugin" in that case) is loaded first gets to define the symbol/function pointerASIO_DECL
are truly "private" because they are inlinedIn the specific case of the "advanced scene switcher" plugin, the core (but not root) issue is that when a "scheduler" service is needed, the execution context's service registry already has a scheduler service (its type_info
is correctly set), but it is not properly initialised.
So when a kqueue_generator
is initialised (which requires a scheduler as part of its initialiser), it crashes when it attempts to call the empty/non-existent get_task
callback.
I haven't dug into why there is a wrong/badly initialised scheduler already present in the service registry, but given that any call to a templated function from a consecutive dynamic library will end up in the address space of the first dynamic library that has asio
included might always lead to issues on version mismatches.
[!NOTE] Possibly fixed in the project via https://github.com/obsproject/obs-studio/pull/9623. Implementing
asio
as a header-only library in dynamic libraries and loading both at runtime indirectly violates C++' One-Definition-Rule, though I dunno if decorating more functions withASIO_DECL
to inline them might also fix this issue (as inline functions seem to be moved into theTEXT
section of the library).
I know this is old, but for future readers (including myself):
ASIO allows you to define ASIO_DISABLE_VISIBILITY to disable any symbol visibility pragmas. Combine this with setting visibility to hidden and the problem will be solved.
More info on this: https://forum.juce.com/t/asio-think-async-version-1-22-1-crashes-pro-tools/56482/2
I've been having some crash issues on MacOS when software plugins that link their own ASIO are installed. Basically, one plugin might statically link 1.12.1, while another will link 1.21.0. When one opens a socket, it's fine. But when the second plugin opens a socket, we get a SIGSEGV in the kqueue_reactor code. This only happens when there's an ASIO version mismatch between the two plugins. Keep in mind, these plugins do not share resources from our end. websocketpp and asio are both statically linked.
Here's a stacktrace:
This appears to be possibly related to #641
This is keeping multiple independent plugin developers for OBS from updating their ASIO versions, because updating one plugin means all other plugins using ASIO must update to the same exact version.