Skip to content
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

Open
onar3d opened this issue Oct 24, 2024 · 17 comments
Assignees
Labels

Comments

@onar3d
Copy link

onar3d commented Oct 24, 2024

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.

@onar3d onar3d changed the title On MacOS, with latest master, a liboossia oscquery instance crashes on exit - now with stacktrace On MacOS, with latest master, a libossia oscquery instance crashes on exit - now with stacktrace Oct 24, 2024
@jcelerier jcelerier self-assigned this Oct 24, 2024
@jcelerier
Copy link
Member

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

@onar3d
Copy link
Author

onar3d commented Oct 25, 2024

Very good suggestion!

On instantiation, address sanitizer breaks on this code:


auto inPortInt = static_cast<int>(inPort.getValue());
auto hostString = queryHostString.toStdString();
Here -> auto protocol = new ossia::oscquery::oscquery_mirror_protocol(hostString, inPortInt);
m_Device = std::make_unique<ossia::net::generic_device>(std::unique_ptr<ossia::net::protocol_base>(protocol), "Mirror");

(...)

With:

=================================================================
==31173==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000112057fa0 at pc 0x00010aece3c4 bp 0x00016fe025d0 sp 0x00016fe01d90
WRITE of size 56 at 0x000112057fa0 thread T29
    #0 0x10aece3c0 in wrap_memset+0x274 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x1a3c0)
    #1 0x10ddddc18 in std::__1::mutex::mutex[abi:ue170006]()+0x30 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/libossia.dylib:arm64+0x5c18)
    #2 0x10dddd788 in std::__1::mutex::mutex[abi:ue170006]()+0x18 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/libossia.dylib:arm64+0x5788)
    #3 0x10e2eb6bc in ossia::oscquery::oscquery_mirror_protocol::oscquery_mirror_protocol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned short)+0x17c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/libossia.dylib:arm64+0x5136bc)
    #4 0x10e2ebce0 in ossia::oscquery::oscquery_mirror_protocol::oscquery_mirror_protocol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned short)+0x28 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/libossia.dylib:arm64+0x513ce0)
    #5 0x100c4b6e0 in OSCQueryAddress::connectAndQuery()+0x47c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10087f6e0)
    #6 0x100c574b8 in OSCQueryAddress::run()+0x2b8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10088b4b8)
    #7 0x10236c070 in juce::Thread::threadEntryPoint()+0x418 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa0070)
    #8 0x10236c9d8 in juce::juce_threadEntryPoint(void*)+0x14 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa09d8)
    #9 0x1025f5928 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::operator()(void*) const+0x2d0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x102229928)
    #10 0x1025f55b4 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::__invoke(void*)+0x118 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1022295b4)
    #11 0x10ae395bc in _pthread_start+0x84 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0x15bc)
    #12 0x10ae43a9c in thread_start+0x4 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0xba9c)

0x000112057fa0 is located 0 bytes after 800-byte region [0x000112057c80,0x000112057fa0)
allocated by thread T29 here:
    #0 0x10af1574c in wrap__Znwm+0x74 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x6174c)
    #1 0x100c4b6a4 in OSCQueryAddress::connectAndQuery()+0x440 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10087f6a4)
    #2 0x100c574b8 in OSCQueryAddress::run()+0x2b8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10088b4b8)
    #3 0x10236c070 in juce::Thread::threadEntryPoint()+0x418 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa0070)
    #4 0x10236c9d8 in juce::juce_threadEntryPoint(void*)+0x14 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa09d8)
    #5 0x1025f5928 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::operator()(void*) const+0x2d0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x102229928)
    #6 0x1025f55b4 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::__invoke(void*)+0x118 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1022295b4)
    #7 0x10ae395bc in _pthread_start+0x84 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0x15bc)
    #8 0x10ae43a9c in thread_start+0x4 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0xba9c)

Thread T29 created by T0 here:
    #0 0x10aeffd6c in wrap_pthread_create+0x54 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4bd6c)
    #1 0x102406a4c in juce::makeThreadHandle(juce::PosixThreadAttribute&, void*, void* (*)(void*))+0x170 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10203aa4c)
    #2 0x10236ccf8 in juce::Thread::createNativeThread(juce::Thread::Priority)+0x288 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa0cf8)
    #3 0x10236ca1c in juce::Thread::startThreadInternal(juce::Thread::Priority)+0x34 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa0a1c)
    #4 0x10236d244 in juce::Thread::startThread(juce::Thread::Priority)+0x178 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa1244)
    #5 0x10236d0b8 in juce::Thread::startThread()+0x18 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fa10b8)
    #6 0x100c400a8 in OSCQueryAddress::triggerQuery()+0x1f0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1008740a8)
    #7 0x100c5af64 in OSCQueryAddress::setLocation(Location*, bool)+0x5e4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10088ef64)
    #8 0x101283068 in AddAddress::AddAddress(Controller*, AddressType)+0x10fc (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x100eb7068)
    #9 0x101283d5c in AddAddress::AddAddress(Controller*, AddressType)+0x28 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x100eb7d5c)
    #10 0x100888f8c in AddressCreationPicker::buttonClicked(juce::Button*)+0x1e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1004bcf8c)
    #11 0x103f3384c in juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7::operator()(juce::Button::Listener&) const+0xe0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103b6784c)
    #12 0x103f32e14 in void juce::ListenerList<juce::Button::Listener, juce::Array<juce::Button::Listener*, juce::DummyCriticalSection, 0>>::callCheckedExcluding<juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7, juce::Component::BailOutChecker>(juce::Button::Listener*, juce::Component::BailOutChecker const&, juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7&&)+0x6e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103b66e14)
    #13 0x10375fd54 in void juce::ListenerList<juce::Button::Listener, juce::Array<juce::Button::Listener*, juce::DummyCriticalSection, 0>>::callChecked<juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7, juce::Component::BailOutChecker>(juce::Component::BailOutChecker const&, juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7&&)+0x28 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103393d54)
    #14 0x10375c3b8 in juce::Button::sendClickMessage(juce::ModifierKeys const&)+0x53c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033903b8)
    #15 0x10375ed38 in juce::Button::internalClickCallback(juce::ModifierKeys const&)+0x200 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103392d38)
    #16 0x103760694 in juce::Button::mouseUp(juce::MouseEvent const&)+0x32c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103394694)
    #17 0x1037b569c in juce::Component::internalMouseUp(juce::MouseInputSource, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0xb0c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033e969c)
    #18 0x103b33e0c in juce::detail::MouseInputSourceImpl::sendMouseUp(juce::Component&, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0x5e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103767e0c)
    #19 0x103b32304 in juce::detail::MouseInputSourceImpl::setButtons(juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0x744 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103766304)
    #20 0x10398b558 in juce::detail::MouseInputSourceImpl::handleEvent(juce::ComponentPeer&, juce::Point<float>, juce::Time, juce::ModifierKeys, float, float, juce::PenDetails)+0xbd0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1035bf558)
    #21 0x10398a8d0 in juce::MouseInputSource::handleEvent(juce::ComponentPeer&, juce::Point<float>, long long, juce::ModifierKeys, float, float, juce::PenDetails const&)+0x640 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1035be8d0)
    #22 0x103745b14 in juce::ComponentPeer::handleMouseEvent(juce::MouseInputSource::InputSourceType, juce::Point<float>, juce::ModifierKeys, float, float, long long, juce::PenDetails, int)+0x5ac (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103379b14)
    #23 0x103ab4cec in juce::NSViewComponentPeer::sendMouseEvent(NSEvent*)+0x5f4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036e8cec)
    #24 0x103ab9784 in juce::NSViewComponentPeer::redirectMouseUp(NSEvent*)+0x1e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036ed784)
    #25 0x103ab1bbc in void juce::JuceNSViewClass::callOnOwner<void (juce::NSViewComponentPeer::*)(NSEvent*), NSEvent*&>(objc_object*, void (juce::NSViewComponentPeer::*&&)(NSEvent*), NSEvent*&)+0x150 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036e5bbc)
    #26 0x103a8f88c in juce::JuceNSViewClass::asyncMouseUp(objc_object*, objc_selector*, NSEvent*)+0x1e8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036c388c)
    #27 0x103a8fa40 in juce::JuceNSViewClass::mouseUp(objc_object*, objc_selector*, NSEvent*)+0x4c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036c3a40)
    #28 0x19bdffa60 in _routeMouseUpEvent+0x80 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0xb76a60)
    #29 0x19b3ef514 in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]+0x130 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x166514)
    #30 0x19b3ef20c in -[NSWindow(NSEventRouting) sendEvent:]+0x118 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x16620c)
    #31 0x19bab84ec in -[NSApplication(NSEventRouting) sendEvent:]+0x640 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x82f4ec)
    #32 0x19b705d98 in -[NSApplication _handleEvent:]+0x38 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x47cd98)
    #33 0x19b2b601c in -[NSApplication run]+0x1fc (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x2d01c)
    #34 0x102968538 in juce::MessageManager::runDispatchLoop()+0xe4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10259c538)
    #35 0x102968274 in juce::JUCEApplicationBase::main()+0x340 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10259c274)
    #36 0x102967ed8 in juce::JUCEApplicationBase::main(int, char const**)+0xfc (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10259bed8)
    #37 0x1018913a4 in main+0x70 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1014c53a4)
    #38 0x1975fb150  (<unknown module>)

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+0x1a3c0) in wrap_memset+0x274
Shadow bytes around the buggy address:
  0x000112057d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000112057d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000112057e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000112057e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000112057f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x000112057f80: 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa
  0x000112058000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x000112058080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x000112058100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x000112058180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x000112058200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==31173==ABORTING
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.

The arguments are all allocated locally in the method, and I also tried this:

auto protocol = new ossia::oscquery::oscquery_mirror_protocol("ws://127.0.0.1:5678", 1234);

Getting the same result.
I suppose that would explain it, what do you make of it?

Thanks!

@jcelerier
Copy link
Member

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 :)
I'll try on my M1 macmini asap, I'm away from home for a week though.

@onar3d
Copy link
Author

onar3d commented Oct 29, 2024

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.
The builds are necessarily ever so slightly different between mac and windows, but nothing I could imagine affects this.

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.

@jcelerier
Copy link
Member

Aha I wish it were holidays for me ! :) I'm back home, will be able to try soon on a M2 mac

@onar3d
Copy link
Author

onar3d commented Oct 31, 2024

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.

@jcelerier
Copy link
Member

jcelerier commented Nov 5, 2024

So I rebuilt everything on my side on m1 like this:

$ cmake ~/ossia/score/3rdparty/libossia -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja -DCMAKE_C_FLAGS="-fsanitize=address -fsanitize=undefined" -DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=undefined"  -DOSSIA_TESTING=1  -DOSSIA_EXAMPLES=1  -DOSSIA_OVERRIDE_PROTOCOLS="OSC;AUDIO;MIDI;OSCQuery"

but all the OSCQuery-related unit tests and examples work without issue :/ can you try on your side ?
if you build with these flags you should have for instance

./examples/ossia_network_oscquery_publication_example

and

./examples/ossia_network_oscquery_exploration_example

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:

 -DBOOST_MATH_DISABLE_FLOAT128=1 
-DBOOST_NO_RTTI=1 
-DFMT_HEADER_ONLY=1 
-DFMT_STATIC_THOUSANDS_SEPARATOR=1 
-DFMT_USE_FLOAT128=0 
-DFMT_USE_INT128=0 
-DFMT_USE_LONG_DOUBLE=0 
-DLIBREMIDI_COREMIDI 
-DLIBREMIDI_JACK
 -DLIBREMIDI_KEYBOARD 
-DLIBREMIDI_USE_BOOST 
-DLIBREMIDI_WEAKJACK 
-DOSSIA_EXPORTS 
-DRAPIDJSON_HAS_STDSTRING=1 
-DSERVUS_USE_DNSSD 
-DSPDLOG_DEBUG_ON=1 
-DSPDLOG_FMT_EXTERNAL=1 
-DSPDLOG_NO_DATETIME=1 
-DSPDLOG_NO_NAME=1 
-DSPDLOG_NO_THREAD_ID=1 
-DSPDLOG_TRACE_ON=1 
-DTINYSPLINE_DOUBLE_PRECISION

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 ?

@jcelerier
Copy link
Member

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 :/

@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

Thank you for this, and for taking the time, I'll do as you say today and see!

@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

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.

@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

I still get an error from the Address Sanitizer on instantiation, this time it's different.
I'll go though my flags and settings as you suggest - but meanwhile, I can post it anyway:

#0 0x000000010f99d060 in __asan::AsanDie() () #1 0x000000010f9b6e24 in __sanitizer::Die() () #2 0x000000010f99af54 in __asan::ScopedInErrorReport::~ScopedInErrorReport() () #3 0x000000010f99a22c in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) () #4 0x000000010f991078 in __asan_memset () #5 0x00000001163d549c in std::__1::mutex::mutex[abi:ue170006]() [inlined] at /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__mutex/mutex.h:25 #6 0x00000001163d5470 in std::__1::mutex::mutex[abi:ue170006]() [inlined] at /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__mutex/mutex.h:28 #7 0x00000001163d5470 in ossia::oscquery::oscquery_mirror_protocol::oscquery_mirror_protocol(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned short) at /Users/iliasbergstrom/Documents/TWO Dev/libossia/src/ossia/network/oscquery/oscquery_mirror.cpp:76 #8 0x00000001056968f0 in OSCQueryAddress::connectAndQuery() at /Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Source/Mediator/Model/Addresses/OscQueryAddress.cpp:465 #9 0x00000001056a28fc in OSCQueryAddress::run() at /Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Source/Mediator/Model/Addresses/OscQueryAddress.cpp:1018 #10 0x0000000106dc6c10 in juce::Thread::threadEntryPoint() at /Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Source/JuceLibraryCode/modules/juce_core/threads/juce_Thread.cpp:110

`=================================================================
==96546==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000119867fa0 at pc 0x00010f991058 bp 0x00016b78e6f0 sp 0x00016b78deb0
WRITE of size 56 at 0x000119867fa0 thread T28
#0 0x10f991054 in __asan_memset+0x208 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x51054)
#1 0x1163d5498 in ossia::oscquery::oscquery_mirror_protocol::oscquery_mirror_protocol(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, unsigned short)+0x490 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libossia.dylib:arm64+0xeed498)
#2 0x1056968ec in OSCQueryAddress::connectAndQuery()+0x47c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1008828ec)
#3 0x1056a28f8 in OSCQueryAddress::run()+0x2b8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10088e8f8)
#4 0x106dc6c0c in juce::Thread::threadEntryPoint()+0x418 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb2c0c)
#5 0x106dc7574 in juce::juce_threadEntryPoint(void*)+0x14 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb3574)
#6 0x107050520 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::operator()(void*) const+0x2d0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10223c520)
#7 0x1070501ac in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::__invoke(void*)+0x118 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10223c1ac)
#8 0x10f8c55bc in _pthread_start+0x84 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0x15bc)
#9 0x10f8cfa9c in thread_start+0x4 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0xba9c)

0x000119867fa0 is located 0 bytes after 800-byte region [0x000119867c80,0x000119867fa0)
allocated by thread T28 here:
#0 0x10f9a174c in wrap__Znwm+0x74 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x6174c)
#1 0x1056968b0 in OSCQueryAddress::connectAndQuery()+0x440 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1008828b0)
#2 0x1056a28f8 in OSCQueryAddress::run()+0x2b8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10088e8f8)
#3 0x106dc6c0c in juce::Thread::threadEntryPoint()+0x418 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb2c0c)
#4 0x106dc7574 in juce::juce_threadEntryPoint(void*)+0x14 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb3574)
#5 0x107050520 in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::operator()(void*) const+0x2d0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10223c520)
#6 0x1070501ac in juce::Thread::createNativeThread(juce::Thread::Priority)::$_28::__invoke(void*)+0x118 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10223c1ac)
#7 0x10f8c55bc in _pthread_start+0x84 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0x15bc)
#8 0x10f8cfa9c in thread_start+0x4 (/usr/lib/system/introspection/libsystem_pthread.dylib:arm64e+0xba9c)

Thread T28 created by T0 here:
#0 0x10f98bd6c in wrap_pthread_create+0x54 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/Frameworks/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4bd6c)
#1 0x106e615e8 in juce::makeThreadHandle(juce::PosixThreadAttribute&, void*, void* ()(void))+0x170 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10204d5e8)
#2 0x106dc7894 in juce::Thread::createNativeThread(juce::Thread::Priority)+0x288 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb3894)
#3 0x106dc75b8 in juce::Thread::startThreadInternal(juce::Thread::Priority)+0x34 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb35b8)
#4 0x106dc7de0 in juce::Thread::startThread(juce::Thread::Priority)+0x178 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb3de0)
#5 0x106dc7c54 in juce::Thread::startThread()+0x18 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x101fb3c54)
#6 0x10568b2b4 in OSCQueryAddress::triggerQuery()+0x1f0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1008772b4)
#7 0x1056a63a4 in OSCQueryAddress::setLocation(Location*, bool)+0x5e4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1008923a4)
#8 0x105cdcea8 in AddAddress::AddAddress(Controller*, AddressType)+0x10fc (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x100ec8ea8)
#9 0x105cddb9c in AddAddress::AddAddress(Controller*, AddressType)+0x28 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x100ec9b9c)
#10 0x1052d37f0 in AddressCreationPicker::buttonClicked(juce::Button*)+0x1e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1004bf7f0)
#11 0x108990574 in juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7::operator()(juce::Button::Listener&) const+0xe0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103b7c574)
#12 0x10898fb3c in void juce::ListenerList<juce::Button::Listener, juce::Array<juce::Button::Listener*, juce::DummyCriticalSection, 0>>::callCheckedExcluding<juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7, juce::Component::BailOutChecker>(juce::Button::Listener*, juce::Component::BailOutChecker const&, juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7&&)+0x6e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103b7bb3c)
#13 0x1081bbda0 in void juce::ListenerList<juce::Button::Listener, juce::Array<juce::Button::Listener*, juce::DummyCriticalSection, 0>>::callChecked<juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7, juce::Component::BailOutChecker>(juce::Component::BailOutChecker const&, juce::Button::sendClickMessage(juce::ModifierKeys const&)::$_7&&)+0x28 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033a7da0)
#14 0x1081b8404 in juce::Button::sendClickMessage(juce::ModifierKeys const&)+0x53c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033a4404)
#15 0x1081bad84 in juce::Button::internalClickCallback(juce::ModifierKeys const&)+0x200 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033a6d84)
#16 0x1081bc6e0 in juce::Button::mouseUp(juce::MouseEvent const&)+0x32c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033a86e0)
#17 0x1082116e8 in juce::Component::internalMouseUp(juce::MouseInputSource, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0xb0c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1033fd6e8)
#18 0x108590a6c in juce::detail::MouseInputSourceImpl::sendMouseUp(juce::Component&, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0x5e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10377ca6c)
#19 0x10858ef98 in juce::detail::MouseInputSourceImpl::setButtons(juce::detail::PointerState const&, juce::Time, juce::ModifierKeys)+0x744 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10377af98)
#20 0x1083e7fa0 in juce::detail::MouseInputSourceImpl::handleEvent(juce::ComponentPeer&, juce::Point, juce::Time, juce::ModifierKeys, float, float, juce::PenDetails)+0xbd0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1035d3fa0)
#21 0x1083e7318 in juce::MouseInputSource::handleEvent(juce::ComponentPeer&, juce::Point, long long, juce::ModifierKeys, float, float, juce::PenDetails const&)+0x640 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1035d3318)
#22 0x1081a1b58 in juce::ComponentPeer::handleMouseEvent(juce::MouseInputSource::InputSourceType, juce::Point, juce::ModifierKeys, float, float, long long, juce::PenDetails, int)+0x5ac (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x10338db58)
#23 0x108511980 in juce::NSViewComponentPeer::sendMouseEvent(NSEvent*)+0x5f4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036fd980)
#24 0x108516418 in juce::NSViewComponentPeer::redirectMouseUp(NSEvent*)+0x1e0 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x103702418)
#25 0x10850e850 in void juce::JuceNSViewClass::callOnOwner<void (juce::NSViewComponentPeer::)(NSEvent), NSEvent*&>(objc_object*, void (juce::NSViewComponentPeer::&&)(NSEvent), NSEvent*&)+0x150 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036fa850)
#26 0x1084ec520 in juce::JuceNSViewClass::asyncMouseUp(objc_object*, objc_selector*, NSEvent*)+0x1e8 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036d8520)
#27 0x1084ec6d4 in juce::JuceNSViewClass::mouseUp(objc_object*, objc_selector*, NSEvent*)+0x4c (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1036d86d4)
#28 0x19bdffa60 in _routeMouseUpEvent+0x80 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0xb76a60)
#29 0x19b3ef514 in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]+0x130 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x166514)
#30 0x19b3ef20c in -[NSWindow(NSEventRouting) sendEvent:]+0x118 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x16620c)
#31 0x19bab84ec in -[NSApplication(NSEventRouting) sendEvent:]+0x640 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x82f4ec)
#32 0x19b705d98 in -[NSApplication _handleEvent:]+0x38 (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x47cd98)
#33 0x19b2b601c in -[NSApplication run]+0x1fc (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit:arm64e+0x2d01c)
#34 0x1073c2fc8 in juce::MessageManager::runDispatchLoop()+0xe4 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1025aefc8)
#35 0x1073c2d04 in juce::JUCEApplicationBase::main()+0x340 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1025aed04)
#36 0x1073c2968 in juce::JUCEApplicationBase::main(int, char const**)+0xfc (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1025ae968)
#37 0x1062ecd64 in main+0x70 (/Users/iliasbergstrom/Documents/TWO Dev/two/trunk/Builds/MacOSX/build/Debug/TWO.app/Contents/MacOS/TWO:arm64+0x1014d8d64)
#38 0x1975fb150 ()

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
Shadow bytes around the buggy address:
0x000119867d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x000119867d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x000119867e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x000119867e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x000119867f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x000119867f80: 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa
0x000119868000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x000119868080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x000119868100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x000119868180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x000119868200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==96546==ABORTING`

@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

Also publication and exploration run fine now that they both build.

@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

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.

@onar3d onar3d closed this as completed Nov 5, 2024
@onar3d onar3d reopened this Nov 5, 2024
@onar3d
Copy link
Author

onar3d commented Nov 5, 2024

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.

@jcelerier
Copy link
Member

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)

@onar3d
Copy link
Author

onar3d commented Nov 6, 2024

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!

@jcelerier
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants