Audio Unit using URL class makes Vienna Ensemble crash


#1

Hi All,

my plugin uses an URL object to check for the product authorization, it does a POST call from prepareToPlay() method.
The plugin runs very well on Logic, Cubase and other hosts. Though on Vienna Ensemble Pro 5 it crashes.
Here’s the crash log; it seems that the issue is related to JuceURLConnectionMessageThread.

Any ideas?
Emanuele

Process:         Vienna Ensemble Pro [192]
Path:            /Applications/Vienna Ensemble Pro/Vienna Ensemble Pro Server (64-bit).app/Contents/MacOS/Vienna Ensemble Pro
Identifier:      at.co.vsl.viennaensemblepro
Version:         5.0.9753 (5.0.9753)
Code Type:       X86-64 (Native)
Parent Process:  launchd [170]

Date/Time:       2011-12-14 16:22:18.223 -0800
OS Version:      Mac OS X 10.7.2 (11C74)
Report Version:  9

Interval Since Last Report:          67962 sec
Crashes Since Last Report:           15
Per-App Interval Since Last Report:  227128 sec
Per-App Crashes Since Last Report:   13
Anonymous UUID:                      4017181A-1BE1-48FA-A651-D149B09D8008

Crashed Thread:  9

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010

VM Regions Near 0x10:
--> 
    __TEXT                 0000000100000000-0000000100c58000 [ 12.3M] r-x/rwx SM=COW  /Applications/Vienna Ensemble Pro/Vienna Ensemble Pro Server (64-bit).app/Contents/MacOS/Vienna Ensemble Pro

Application Specific Information:
objc_msgSend() selector name: createConnection
objc[192]: garbage collection is OFF

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff90551e42 __semwait_signal + 10
1   libsystem_c.dylib             	0x00007fff868e2dea nanosleep + 164
2   com.test.TestPlugin_x64 	0x0000000117893f7c -[JuceURLConnection_1_53_107_TestPlugin initWithRequest:withCallback:withContext:] + 604
3   com.test.TestPlugin_x64 	0x00000001178da462 juce::WebInputStream::createConnection(bool (*)(void*, int, int), void*) + 354
4   com.test.TestPlugin_x64 	0x00000001178bd754 juce::URL::createNativeStream(juce::String const&, bool, juce::MemoryBlock const&, bool (*)(void*, int, int), void*, juce::String const&, int, juce::StringPairArray*) + 308
5   com.test.TestPlugin_x64 	0x00000001175f7bd8 juce::URL::createInputStream(bool, bool (*)(void*, int, int), void*, juce::String const&, int, juce::StringPairArray*) const + 216
6   com.test.TestPlugin_x64 	0x00000001175f7c6f juce::URL::readEntireTextStream(bool) const + 47
7   com.test.TestPlugin_x64 	0x00000001178e7586 Test_Copy_Protection::checkURL(juce::String) + 166
8   com.test.TestPlugin_x64 	0x000000011752167a TestPlugin::checkPassOrProductKey() + 858
9   com.test.TestPlugin_x64 	0x000000011752d2d9 TestPlugin::prepareToPlay(double, int) + 6073
10  com.test.TestPlugin_x64 	0x0000000117566344 JuceAU::prepareToPlay() + 276
11  com.test.TestPlugin_x64 	0x0000000117566540 JuceAU::Initialize() + 112
12  com.test.TestPlugin_x64 	0x0000000117551f06 AUBase::DoInitialize() + 54
13  com.test.TestPlugin_x64 	0x000000011755887c AUBase::ComponentEntryDispatch(ComponentParameters*, AUBase*) + 924
14  com.test.TestPlugin_x64 	0x00000001175651d3 TestPluginEntry + 35
15  com.apple.audio.toolbox.AudioToolbox	0x00007fff8b26ba2c _AT_AudioUnitInitialize + 112
16  at.co.vsl.viennaensemblepro   	0x0000000100019b37 AUPlugin::initialize() + 119
17  at.co.vsl.viennaensemblepro   	0x000000010001a2e1 AUPlugin::getGui(bool) + 113
18  at.co.vsl.viennaensemblepro   	0x0000000100248623 InstrumentSource::getGui(bool) + 83
19  at.co.vsl.viennaensemblepro   	0x00000001002e2637 VFMainWindow::channelCurrentChanged(ChannelSource*) + 919
20  at.co.vsl.viennaensemblepro   	0x00000001002ff7d1 VFMainWindow::updateInsertVstiMenu() + 3745
21  QtCore                        	0x0000000101218b84 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 1588
22  at.co.vsl.viennaensemblepro   	0x00000001004a3a81 VIAudioEngine::channelCurrentChanged(ChannelSource*) + 49
23  at.co.vsl.viennaensemblepro   	0x00000001002e291b VFMainWindow::perform_addVsti(QAction*) + 539
24  at.co.vsl.viennaensemblepro   	0x00000001002ff5e7 VFMainWindow::updateInsertVstiMenu() + 3255
25  QtCore                        	0x0000000101214c67 QObject::event(QEvent*) + 1079
26  QtGui                         	0x00000001015b373e QWidget::event(QEvent*) + 78
27  QtGui                         	0x0000000101963fbb QMainWindow::event(QEvent*) + 219
28  QtGui                         	0x000000010155a86d QApplicationPrivate::notify_helper(QObject*, QEvent*) + 189
29  QtGui                         	0x0000000101561864 QApplication::notify(QObject*, QEvent*) + 1060
30  QtCore                        	0x0000000101200bdc QCoreApplication::notifyInternal(QObject*, QEvent*) + 124
31  QtCore                        	0x0000000101201fc4 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 740
32  com.apple.CoreFoundation      	0x00007fff882acb51 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33  com.apple.CoreFoundation      	0x00007fff882ac3bd __CFRunLoopDoSources0 + 253
34  com.apple.CoreFoundation      	0x00007fff882d31a9 __CFRunLoopRun + 905
35  com.apple.CoreFoundation      	0x00007fff882d2ae6 CFRunLoopRunSpecific + 230
36  com.apple.HIToolbox           	0x00007fff8d8bb3d3 RunCurrentEventLoopInMode + 277
37  com.apple.HIToolbox           	0x00007fff8d8c258f ReceiveNextEventCommon + 181
38  com.apple.HIToolbox           	0x00007fff8d8c24ca BlockUntilNextEventMatchingListInMode + 62
39  com.apple.AppKit              	0x00007fff8dc263f1 _DPSNextEvent + 659
40  com.apple.AppKit              	0x00007fff8dc25cf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
41  com.apple.AppKit              	0x00007fff8dc2262d -[NSApplication run] + 470
42  QtGui                         	0x0000000101516c00 QDesktopWidget::resizeEvent(QResizeEvent*) + 13152
43  QtCore                        	0x00000001011ffb04 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 68
44  QtCore                        	0x00000001011ffeb4 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 324
45  QtCore                        	0x000000010120254c QCoreApplication::exec() + 188
46  at.co.vsl.viennaensemblepro   	0x000000010045da36 main + 9446
47  at.co.vsl.viennaensemblepro   	0x000000010000a0c4 start + 52

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib        	0x00007fff905527e6 kevent + 10
1   libdispatch.dylib             	0x00007fff901525be _dispatch_mgr_invoke + 923
2   libdispatch.dylib             	0x00007fff9015114e _dispatch_mgr_thread + 54

Thread 2:
0   libsystem_kernel.dylib        	0x00007fff90552a7a poll + 10
1   at.co.vsl.viennaensemblepro   	0x0000000100555a75 ost::Socket::isPending(ost::Socket::Pending, unsigned long) + 101
2   at.co.vsl.viennaensemblepro   	0x00000001002547ff ServerThread::run() + 335
3   QtCore                        	0x00000001010edd9a QThread::terminate() + 762
4   libsystem_c.dylib             	0x00007fff8692c8bf _pthread_start + 335
5   libsystem_c.dylib             	0x00007fff8692fb75 thread_start + 13

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff90551df2 __select + 10
1   QtCore                        	0x000000010123173e qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 142
2   QtNetwork                     	0x00000001020e46af QLocalServer::listen(QString const&) + 17327
3   QtNetwork                     	0x00000001020e28ea QLocalServer::listen(QString const&) + 9706
4   QtNetwork                     	0x00000001020d91ab QAbstractSocket::waitForReadyRead(int) + 251
5   at.co.vsl.viennaensemblepro   	0x00000001002b974d AdvertiseSocketThread::run() + 317
6   QtCore                        	0x00000001010edd9a QThread::terminate() + 762
7   libsystem_c.dylib             	0x00007fff8692c8bf _pthread_start + 335
8   libsystem_c.dylib             	0x00007fff8692fb75 thread_start + 13

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff9055067a mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff9054fd71 mach_msg + 73
2   com.apple.audio.midi.CoreMIDI 	0x0000000100fcc5be XServerMachPort::ReceiveMessage(int&, void*, int&) + 96
3   com.apple.audio.midi.CoreMIDI 	0x0000000100fed653 MIDIProcess::RunMIDIInThread() + 207
4   com.apple.audio.midi.CoreMIDI 	0x0000000100fcd96a XThread::RunHelper(void*) + 10
5   com.apple.audio.midi.CoreMIDI 	0x0000000100fcd396 CAPThread::Entry(CAPThread*) + 98
6   libsystem_c.dylib             	0x00007fff8692c8bf _pthread_start + 335
7   libsystem_c.dylib             	0x00007fff8692fb75 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib        	0x00007fff90551bca __psynch_cvwait + 10
1   libsystem_c.dylib             	0x00007fff86930274 _pthread_cond_wait + 840
2   QtCore                        	0x00000001010eca6f QThread::currentThreadId() + 127
3   QtCore                        	0x00000001010ecbc3 QThread::msleep(unsigned long) + 147
4   at.co.vsl.viennaensemblepro   	0x00000001003ebc40 MirLoadingThread::run() + 21872
5   QtCore                        	0x00000001010edd9a QThread::terminate() + 762
6   libsystem_c.dylib             	0x00007fff8692c8bf _pthread_start + 335
7   libsystem_c.dylib             	0x00007fff8692fb75 thread_start + 13

Thread 6:
0   libsystem_kernel.dylib        	0x00007fff90552192 __workq_kernreturn + 10
1   libsystem_c.dylib             	0x00007fff8692e594 _pthread_wqthread + 758
2   libsystem_c.dylib             	0x00007fff8692fb85 start_wqthread + 13

Thread 7:
0   libsystem_kernel.dylib        	0x00007fff90552192 __workq_kernreturn + 10
1   libsystem_c.dylib             	0x00007fff8692e594 _pthread_wqthread + 758
2   libsystem_c.dylib             	0x00007fff8692fb85 start_wqthread + 13

Thread 8:

Thread 9 Crashed:
0   libobjc.A.dylib               	0x00007fff8d3bdfdf objc_msgSend_fixup + 95
1   at.co.vsl.viennaensemblepro   	0x00000001006b5828 JuceURLConnectionMessageThread::run() + 40
2   com.test.TestPlugin_x64 	0x00000001175da38e juce::Thread::threadEntryPoint() + 494
3   com.test.TestPlugin_x64 	0x00000001178bdbd2 juce::threadEntryProc(void*) + 66
4   libsystem_c.dylib             	0x00007fff8692c8bf _pthread_start + 335
5   libsystem_c.dylib             	0x00007fff8692fb75 thread_start + 13

Thread 9 crashed with X86 Thread State (64-bit):
  rax: 0x0000000100e11ef0  rbx: 0x0000000117449ab8  rcx: 0x0000000000000300  rdx: 0x0000000118796e54
  rdi: 0x0000000000000005  rsi: 0x0000000100d294f0  rbp: 0x0000000118796e70  rsp: 0x0000000118796db0
   r8: 0x0000000118796e5c   r9: 0x000000010074c5a7  r10: 0x0000000000000005  r11: 0x0000000000000000
  r12: 0x0000000000000008  r13: 0x0000000117449ab0  r14: 0x0000000117449ab0  r15: 0x00000001178bdb90
  rip: 0x00007fff8d3bdfdf  rfl: 0x0000000000010206  cr2: 0x0000000000000010
Logical CPU: 14

#2

Looks like you’re using 1.53 - I can only look into this if it’s still a problem in the latest code…?


#3

Hi,

I finally solved (thanks to George) setting:

JuceURLConnectionMessageThread=JuceURLConnectionMessageThread_MyPluginName

in Preprocessor Macros.
I don’t know why but it seems that:

JUCE_ObjCExtraSuffix=MyPluginName

and also:

JUCE_NAMESPACE=MyPluginName
juce=JUCE_NAMESPACE

have no effect on JuceURLConnectionMessageThread

Cheers
Emanuele