-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On MacOS, with latest master, a libossia oscquery instance crashes on exit - now with stacktrace #842
Comments
heya, do you think you could build your software with address sanitizer ? it would help pinpointing where is the error. Simply adding -fsanitize=address to the build & link flags should be enough |
Very good suggestion! On instantiation, address sanitizer breaks on this code:
(...) With:
The arguments are all allocated locally in the method, and I also tried this:
Getting the same result. Thanks! |
thanks for the investigation ! it's pretty strange.. here I'm trying with for instance this example : https://github.com/ossia/libossia/blob/master/examples/Network/OSCQuery_exploration.cpp and ASAN & UBSAN report no errors... I found one with TSAN though but way after creation of the object and I'm still not sure it's not a false positive :) |
It seems like our public holidays are synced, I've been away a few days too. I did a test on Windows, running with the address sanitizer with a Visual Studio build, and there I got no issues. I'll do another test later this week on the M1, double checking that everything matches between the build there and Windows - as much as possible, since on windows I build with VS MSVC, and on Mac xCode. |
Aha I wish it were holidays for me ! :) I'm back home, will be able to try soon on a M2 mac |
I've spent a while updating the project on MacOS so that it's as similar as possible as on windows. I had a small discrepancy - it was on JUCE v8.0.2 when on Windows I used v8.0.3. Couldn't really find that much else, and the issue persists. I'll go through my ifdefs for apple-specific code too just in case. Edit: No ifdefs that are relevant, I checked. Edit2: I also pulled the latest master (5acfa57) just in case, cleaned and rebuilt with asan enabled both for the ossia dylib and my app (they're separate steps since my app uses the antiquated Projucer still). The issue persists. |
So I rebuilt everything on my side on m1 like this:
but all the OSCQuery-related unit tests and examples work without issue :/ can you try on your side ?
and
in the build folder, that you can use to try. If this works, I would assume that the issue is for instance a build flag not being carried along which changes ABI between the .dylib and your app - could be one of these defines missing for instance, or simply a mismatch of debug & release dylib if in debug mode Xcode added for instance _LIBCPP_ASSERTS or something like that. That said I don't see anything that could be critical in there:
Another thing could be maybe your build picks up older libossia headers that would have ended up in e.g. /usr/local or something like that ? |
Or maybe JUCE adds a flag on its side which changes the ABI compared to the libossia.dylib one - in general I'd really recommend building as much as possible with the same flags / environments / build system as it's very trivial to have this kind of issues appear :/ |
Thank you for this, and for taking the time, I'll do as you say today and see! |
I didn't have Ninja on my system before (and didn't use it obviously), already with that change, and pulling the latest master, all examples now build! I'll try running next. |
I still get an error from the Address Sanitizer on instantiation, this time it's different.
`================================================================= 0x000119867fa0 is located 0 bytes after 800-byte region [0x000119867c80,0x000119867fa0) Thread T28 created by T0 here: SUMMARY: AddressSanitizer: heap-buffer-overflow (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x51054) in __asan_memset+0x208 |
Also publication and exploration run fine now that they both build. |
I realized from your comments that when I was building with CMake and no -G argument, that it was using the default makefile target. So I built ossia with -GXcode, and now it links and runs fine! Edit: No it still crashes on exit, as it initially did :D I'll keep testing. |
Seems like the best way to make sure will be to transition to CMake also for my own project - I've been putting it off since it didn't serve too much of a purpose before, but I should do that too, maybe it will solve this. |
Yes, CMake makes sure that the flags get carried from libraries to the code that uses said libraries. It's strange that building ossia with -GMakefile vs -GXcode would change anything. What if you also rebuild ossia with -fsanitize options ? (and maximum debug mode, e.g -DCMAKE_BUILD_TYPE=Debug so that we get the most precise stacktraces) |
I've been doing that, it made no difference. I'm off to the Audio Developer Conference now, but I'll carry on with the steps mentioned as soon as I get a chance! |
okay, keep me posted ! if you want after ADC (would have loved to be there!) we can have a remote session to try an understand where things are going wrong |
Hi,
Thanks for your help on getting libossia working on Windows.
This time I've some trouble on MacOS:
The oscquery device instantiates and works correctly (the same code is stable on Windows).
But then, consistently on exit, it crashes:
JUCE Message Thread (1) Queue : com.apple.main-thread (serial) #0 0x00000001978b62dc in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::~basic_string() () #1 0x000000010c4849bc in ossia::oscquery::oscquery_mirror_protocol::get_ws_promise::~get_ws_promise() () #2 0x000000010c468fbc in ossia::oscquery::oscquery_mirror_protocol::get_ws_promise::~get_ws_promise() () #3 0x000000010c488cec in moodycamel::ReaderWriterQueue<ossia::oscquery::oscquery_mirror_protocol::get_ws_promise, 512ul>::~ReaderWriterQueue() () #4 0x000000010c467c7c in moodycamel::ReaderWriterQueue<ossia::oscquery::oscquery_mirror_protocol::get_ws_promise, 512ul>::~ReaderWriterQueue() () #5 0x000000010c468c00 in ossia::oscquery::oscquery_mirror_protocol::~oscquery_mirror_protocol() () #6 0x000000010c468c74 in ossia::oscquery::oscquery_mirror_protocol::~oscquery_mirror_protocol() () #7 0x000000010c468ca0 in ossia::oscquery::oscquery_mirror_protocol::~oscquery_mirror_protocol() () #8 0x000000010c10eb68 in std::__1::default_delete<ossia::net::protocol_base>::operator()[abi:ue170006](ossia::net::protocol_base*) const () #9 0x000000010c10ead4 in std::__1::unique_ptr<ossia::net::protocol_base, std::__1::default_delete<ossia::net::protocol_base>>::reset[abi:ue170006](ossia::net::protocol_base*) () #10 0x000000010c208a54 in ossia::net::generic_device::~generic_device() () #11 0x000000010c208a98 in ossia::net::generic_device::~generic_device() () #12 0x000000010c208ae0 in ossia::net::generic_device::~generic_device() () #13 0x0000000104a8a604 in std::__1::default_delete<ossia::net::generic_device>::operator()[abi:ue170006](ossia::net::generic_device*) const at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/unique_ptr.h:68 #14 0x0000000104a8a570 in std::__1::unique_ptr<ossia::net::generic_device, std::__1::default_delete<ossia::net::generic_device>>::reset[abi:ue170006](ossia::net::generic_device*) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/unique_ptr.h:300 #15 0x0000000104a79d6c in std::__1::unique_ptr<ossia::net::generic_device, std::__1::default_delete<ossia::net::generic_device>>::operator=[abi:ue170006](std::nullptr_t) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/unique_ptr.h:269 #16 0x0000000104a75808 in OSCQueryAddress::disconnect() at /Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Source/Mediator/Model/Addresses/OscQueryAddress.cpp:578
I'm using boost 1.86 installed separately and linked to the project separately from libossia (on windows it included boost).
This was with the latest master branch of libossia as of today.
I configure the libossia build as follows:
cmake .. -DOSSIA_EDITOR=0 -DOSSIA_DATAFLOW=0 -DOSSIA_EXAMPLES=0 -DOSSIA_CPP=ON -DOSSIA_OVERRIDE_PROTOCOLS=OSCQUERY
I then build and install, no problem there.
Also, as an aside, you may want to know that if I set -DOSSIA_EXAMPLES=1, it fails to build:
[ 85%] Linking CXX executable ossia_network_oscquery_bridge_example Undefined symbols for architecture arm64: "ossia::net::osc_protocol::osc_protocol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned short, unsigned short, std::__1::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>)", referenced from: std::__1::__unique_if<ossia::net::osc_protocol>::__unique_single std::__1::make_unique[abi:ue170006]<ossia::net::osc_protocol, char const (&) [10], int, int>(char const (&) [10], int&&, int&&) in OSCQuery_bridge.cpp.o "ossia::net::osc_protocol::~osc_protocol()", referenced from: std::__1::default_delete<ossia::net::osc_protocol>::operator()[abi:ue170006](ossia::net::osc_protocol*) const in OSCQuery_bridge.cpp.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [examples/ossia_network_oscquery_bridge_example] Error 1 make[1]: *** [examples/CMakeFiles/ossia_network_oscquery_bridge_example.dir/all] Error 2 make: *** [all] Error 2
I've been putting off releasing on MacOS because I can't use libossia, so I'd be very grateful for any tips on what I can do to address the crash - is it a bug in the library or am I doing something wrong?
I'm on an M1 macbook, Sonoma 14.6.1
Thank you,
Ilias B.
The text was updated successfully, but these errors were encountered: