Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS thrown on exit before any exit routines are called #1100

Closed
admsyn opened this Issue Mar 20, 2012 · 8 comments

Comments

Projects
None yet
3 participants
Member

admsyn commented Mar 20, 2012

Hi oF team! I'm having a issue while using some Audio Units along with oF. On Cmd-q, I get an EXC_BAD_ACCESS on the line (in ofAppRunner.cpp):

window->runAppViaInfiniteLoop(OFSAptr.get());

This happens before my app's exit() gets called, before any destructors get called, and before any callbacks registered to ofEvents().exit get called. This seems to occur while using any units by Native Instruments, though not all 3rd party units are as tempermental. I've tested with both the current develop and master branch as of March 20. Mini reproduction example follows:

#include "testApp.h"
#include <AudioToolbox/AudioToolbox.h>

AUGraph graph;

void testApp::setup(){
//  Replace this with the description for a 3rd party Audio Unit
//  that you have installed. Run "auval -a" to see a list of
//  Audio Units you have available. Not all 3rd party Audio Units
//  trigger a crash (though all of NI's seem to). Apple® brand 
//  Audio Units don't seem to be as tempermental
//  
//  This description is for Native Instruments' Reaktor 5 synth.
  AudioComponentDescription desc = {'aumu', 'NiR5', '-NI-'};
  AUNode node;  
  NewAUGraph(&graph);
  AUGraphAddNode(graph, &desc, &node);
  AUGraphInitialize(graph);
  AUGraphOpen(graph);

//  uncomment this to "fix"
//  shutdownAUGraph();
}

void testApp::shutdownAUGraph(){
  AUGraphClose(graph);
  AUGraphUninitialize(graph);
  DisposeAUGraph(graph);
}

void testApp::exit(){
  shutdownAUGraph();
}
Contributor

damian0815 commented Mar 20, 2012

hi @admsyn . i don't have an NI stuff installed here so can't test it.

i have a hunch though: in your main.cpp, are you doing this:

testApp myApp;
ofRunApp(&myApp);

or this:

ofRunApp( new testApp() );

i've seen issues like this doing the former. switching to the latter fixed it.

@ghost ghost assigned damian0815 Mar 20, 2012

Member

admsyn commented Mar 20, 2012

hi @damiannz! I am doing the latter (ofRunApp( new testApp());). I actually used the project generator (current as of March 20th) to generate the project, so everything is the same as that. I removed all of the unused function prototypes from testApp.h though.

I think it's much more related to a bug in the Audio Units than anything in oF since I've so far only been able to reproduce with NI units. The issue I was getting at when I mentioned it in the forums (http://forum.openframeworks.cc/index.php/topic,9330.0.html) was that it could be prevented if I could call the shutdown functions at some point, but the EXC_BAD_ACCESS occurs pretty much instantly.
Contributor

damian0815 commented Mar 20, 2012

ok, then that's not it.

can you (ideally) copy/paste or take a screen shot of the stack trace when it crashes?

Member

admsyn commented Mar 20, 2012

Sure, here's a stack trace on the main thread :

#0 0x956c69c6 in __pthread_kill ()
#1 0x9c35df78 in pthread_kill ()
#2 0x9c34ebdd in abort ()
#3 0x924f3921 in abort_message ()
#4 0x924f11bc in default_terminate() ()
#5 0x924f11fe in safe_handler_caller(void (_)()) ()
#6 0x924f1268 in __cxa_bad_typeid ()
#7 0x924f22a0 in __gxx_exception_cleanup(_Unwind_Reason_Code, Unwind_Exception) ()
#8 0x97457908 in std::_throw_length_error(char const) ()
#9 0x0419bea3 in std::basic_string<unsigned short, std::char_traits, std::allocator >::_Rep::_S_create(unsigned long, unsigned long, std::allocator const&) ()
#10 0x0419c119 in std::basic_string<unsigned short, std::char_traits, std::allocator >::basic_string(std::basic_string<unsigned short, std::char_traits, std::allocator > const&) ()
#11 0x046a49ba in NI::GP::operator+(NI::GP::String const&, NI::GP::String const&) ()
#12 0x05025874 in TReaktor::saveDirectoriesToRegistry() ()
#13 0x04290165 in TReaktor::deInitStatics(ReaktorResourceManager&) ()
#14 0x042e1441 in ReaktorApp::deInit(bool) ()
#15 0x04705a06 in NI::UIA::AppModule::~AppModule() ()
#16 0x9c34e944 in _cxa_finalize ()
#17 0x9c34e7f2 in exit ()
#18 0x91956b0a in +NSMenuItem initialize
#19 0x96329de1 in -NSObject performSelector:withObject:
#20 0x91a5b113 in -NSApplication sendAction:to:from:
#21 0x91b4ee47 in -NSMenuItem _corePerformAction
#22 0x91b4eac4 in -NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:
#23 0x91b4e14d in -NSMenu _performActionWithHighlightingForItemAtIndex:sendAccessibilityNotification:
#24 0x91b4e0f9 in -NSMenu _performActionWithHighlightingForItemAtIndex:
#25 0x91ac7933 in -NSMenu performKeyEquivalent:
#26 0x91ac63a2 in -NSApplication _handleKeyEquivalent:
#27 0x919ba4bf in -NSApplication sendEvent:
#28 0x3e012456 in -GLUTApplication _runMainLoopUntilDate:autoreleasePool:
#29 0x3e0125c0 in -GLUTApplication run
#30 0x3e028df8 in glutMainLoop ()
#31 0x00148779 in ofRunApp(ofBaseApp
) at /Users/Adam/workspace/scratch/openFrameworks/libs/openFrameworks/app/ofAppRunner.cpp:78
#32 0x0000249a in _ZN15ofAppGlutWindowD2Ev inlined
#33 0x0000249a in main ()

The output on the console is :

terminate called throwing an exceptionsharedlibrary apply-load-rules all
warning: Could not find object file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/libgcc.a(_eprintf.o)" - no debug information available for "/var/tmp/gcc_40/gcc_40-5494~211/src/gcc/libgcc2.c".

warning: Could not find object file "/Users/theo/Documents/CODE/__OPENFRAMEWORKS/gitOF/openFrameworks/apps/devApps/macDragDropExample/buildGlutFrameworkHackedWindowLevel10.4/libForeground.a(macx_foreground.o)" - no debug information available for "/Users/mcast/Code/GLUT-ToPost/macx_foreground.m".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUMIDIBase.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUBase.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/AUBase.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(MusicDeviceBase.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUCarbonViewDispatch.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUCarbonViewBase.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(ComponentBase.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/ComponentBase.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUScopeElement.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUInputElement.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/AUInputElement.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUBuffer.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/Utility/AUBuffer.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUOutputElement.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(CAAudioChannelLayout.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/PublicUtility/CAAudioChannelLayout.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(CAVectorUnit.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/PublicUtility/CAVectorUnit.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUDispatch.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUBase/AUDispatch.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(CarbonEventHandler.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(CAStreamBasicDescription.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/PublicUtility/CAStreamBasicDescription.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(AUCarbonViewControl.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp".

warning: Could not find object file "/Users/developer/CVS/external/coreaudio-sdk-1.5-R2/lib/osx/libcoreaudio-sdk-ni.a(CAAUParameter.o)" - no debug information available for "/Users/fdetro/Development/CVS/external/coreaudio-sdk-1.5-R2/PublicUtility/CAAUParameter.cpp".

warning: Could not find object file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_eprintf.o)" - no debug information available for "/var/tmp/gcc/gcc-5659~1/src/gcc/libgcc2.c".

Current language:  auto; currently c++
(gdb) 
Contributor

damian0815 commented May 15, 2012

hi @admsyn, apologies for the long delay in getting back on this. from the stack trace it really looks like an NI problem, rather than an oF problem:

#11 0x046a49ba in NI::GP::operator+(NI::GP::String const&, NI::GP::String const&) ()
#12 0x05025874 in TReaktor::saveDirectoriesToRegistry() ()

... seems to point the finger at Reaktor not checking for an error condition. can you confirm that the code in testApp::exit() is actually being run? (ie, print something to the console before calling shutdownAuGraph() )

Member

admsyn commented May 15, 2012

exit() does get called if I'm using a non-NI unit, but the crash happens before exit() if I am using an NI unit. So yeah, It certainly seems to be an NI issue.

As in:

Normal operation

  1. oF does its thing
  2. CMD-Q
  3. exit() and other cleanup

With an NI-Unit

  1. oF does its thing
  2. CMD-Q
  3. NI-related crash
  4. (never happens) exit() and other cleanup

Again, the only reason I bothered any oF people about this is because I was curious if there was a way to get into the exit routine any earlier than exit(). It doesn't really seem to be an "issue".

Owner

bilderbuchi commented May 15, 2012

so, can we close this as not-our-bug?

Contributor

damian0815 commented May 16, 2012

i think so.

@damian0815 damian0815 closed this May 16, 2012

@admsyn admsyn referenced this issue in admsyn/ofxAudioUnit May 28, 2014

Closed

Sigabrt on exit when using ofxAudioUnitSampler #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment