Hi @reuk, thanks for looking at this.
I’m using Steinberg built-in ASIO Driver v1.0.9.26 x64. The other drivers I have installed are ASIO Fireface, Maschine MK3, Yamaha Steinberg USB ASIO.
Something else that might be pertinent for the repro is that before I switch from ASIO to Windows Audio, I select the Yamaha ASIO device that happens to be the default device for Windows Audio. Another thing I noticed is that often I can repro three times in a row, then it’s ok on the fourth.
I see a few variations of the stack trace:
Exception thrown at 0x00007FF83F4AC801 (ntdll.dll) in DemoRunner.exe: 0xC0000005: Access violation reading location 0x0000000000000010.
> ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
ntdll.dll!RtlEnterCriticalSection() Unknown
asiobtin.dll!00000001800081aa() Unknown
kernel32.dll!00007ff83e0be8d7() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
Exception thrown at 0x0000000180008196 (asiobtin.dll) in DemoRunner.exe: 0xC0000005: Access violation reading location 0x0000000000000068.
> asiobtin.dll!0000000180008196() Unknown
kernel32.dll!00007ff83e0be8d7() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
Exception thrown at 0x00007FF83F4AC801 (ntdll.dll) in DemoRunner.exe: 0xC0000005: Access violation reading location 0x0000000000000010.
> ntdll.dll!RtlpWaitOnCriticalSection() Unknown
ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
ntdll.dll!RtlEnterCriticalSection() Unknown
asiobtin.dll!00000001800081aa() Unknown
kernel32.dll!00007ff83e0be8d7() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
When I set JUCE_ASIO_DEBUGGING=1 then the crash happens far less frequently. However, I eventually managed to capture one:
<snip>
ASIO: found ASIO Fireface
ASIO: found Maschine MK3
ASIO: found Steinberg built-in ASIO Driver
ASIO: found Yamaha Steinberg USB ASIO
ASIO: found ASIO Fireface
ASIO: found Maschine MK3
ASIO: found Steinberg built-in ASIO Driver
ASIO: found Yamaha Steinberg USB ASIO
<snip>
The thread 'JUCE v8.0.12: WASAPI' (16576) has exited with code 0 (0x0).
ASIO: opening device: ASIO Fireface
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\fireface_asio_64.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: closed
ASIO: opening device: ASIO Fireface
ASIO: closed
ASIO: opening device: Maschine MK3
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Native Instruments\Maschine MK3 Driver\asio\nimc3asio64.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\hid.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\dbgcore.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: closed
ASIO: opening device: Steinberg built-in ASIO Driver
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\asiobtin.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: 1 in, 2 out
ASIO: 480->480, 480, 480
ASIO: outputReady true
ASIO: Rates: 8000 12000 16000 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 256000 352800 384000 512000 705600 768000
ASIO: Latencies: in = 480, out = 960
ASIO: creating buffers (dummy): 3, 480
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\soxr.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: Latencies: in = 480, out = 960
ASIO: device open
ASIO: closed
ASIO: opening device: Yamaha Steinberg USB ASIO
<snip>
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Unloaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'. Symbol loading disabled by Include/Exclude setting.
Exception thrown at 0x0000000180008196 (asiobtin.dll) in DemoRunner.exe: 0xC0000005: Access violation reading location 0x0000000000000068.
I understand what you’re saying about it being safe to call disposeBuffers() after stop(). However, the point is that when scanning the ASIO drivers there is no call to disposeBuffers(). If I add this after the stop() call, then the crash seems to be fixed. Fyi, I tried this without the additional sleep() and it was OK.
Here is the debug output with the patch:
ASIO: found ASIO Fireface
ASIO: found Maschine MK3
ASIO: found Steinberg built-in ASIO Driver
ASIO: found Yamaha Steinberg USB ASIO
ASIO: found ASIO Fireface
ASIO: found Maschine MK3
ASIO: found Steinberg built-in ASIO Driver
ASIO: found Yamaha Steinberg USB ASIO
<snip>
ASIO: opening device: ASIO Fireface
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\fireface_asio_64.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: closed
ASIO: opening device: ASIO Fireface
ASIO: closed
ASIO: opening device: Maschine MK3
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Native Instruments\Maschine MK3 Driver\asio\nimc3asio64.dll'. Symbol loading disabled by Include/Exclude setting.
<snip>
ASIO: closed
ASIO: opening device: Steinberg built-in ASIO Driver
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\asiobtin.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: 1 in, 2 out
ASIO: 480->480, 480, 480
ASIO: outputReady true
ASIO: Rates: 8000 12000 16000 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 256000 352800 384000 512000 705600 768000
ASIO: Latencies: in = 480, out = 960
ASIO: creating buffers (dummy): 3, 480
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\soxr.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: Latencies: in = 480, out = 960
The thread 21180 has exited with code 1 (0x1).
'DemoRunner.exe' (Win32): Unloaded 'C:\Program Files\Steinberg\Asio\soxr.dll'
ASIO: device open
ASIO: closed
ASIO: opening device: Yamaha Steinberg USB ASIO
<snip>
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'. Symbol loading disabled by Include/Exclude setting.
'DemoRunner.exe' (Win32): Unloaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files (x86)\Yamaha\Yamaha Steinberg USB Driver\ysusb_asio64.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: 2 in, 2 out
ASIO: 64->64, 64, 0
ASIO: outputReady true
ASIO: Rates: 44100 48000 88200 96000 176400 192000
ASIO: Latencies: in = 184, out = 232
ASIO: creating buffers (dummy): 4, 64
ASIO: Latencies: in = 184, out = 232
The thread 12972 has exited with code 0 (0x0).
ASIO: device open
ASIO: closed
The thread 34092 has exited with code 0 (0x0).
ASIO: opening device: Maschine MK3
ASIO: closed
ASIO: opening device: Steinberg built-in ASIO Driver
ASIO: 1 in, 2 out
ASIO: 480->480, 480, 480
ASIO: outputReady true
ASIO: Rates: 8000 12000 16000 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 256000 352800 384000 512000 705600 768000
ASIO: Latencies: in = 480, out = 960
ASIO: creating buffers (dummy): 3, 480
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\soxr.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: Latencies: in = 480, out = 960
The thread 8376 has exited with code 1 (0x1).
'DemoRunner.exe' (Win32): Unloaded 'C:\Program Files\Steinberg\Asio\soxr.dll'
ASIO: device open
ASIO: closed
ASIO: opening device: Steinberg built-in ASIO Driver
ASIO: 1 in, 2 out
ASIO: 480->480, 480, 480
ASIO: outputReady true
ASIO: Rates: 8000 12000 16000 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 256000 352800 384000 512000 705600 768000
ASIO: Latencies: in = 480, out = 960
ASIO: creating buffers (dummy): 3, 480
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\soxr.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: Latencies: in = 480, out = 960
The thread 7984 has exited with code 1 (0x1).
'DemoRunner.exe' (Win32): Unloaded 'C:\Program Files\Steinberg\Asio\soxr.dll'
ASIO: device open
ASIO: clock: Internal (cur)
ASIO: disposing buffers
ASIO: creating buffers: 3, 480
'DemoRunner.exe' (Win32): Loaded 'C:\Program Files\Steinberg\Asio\soxr.dll'. Symbol loading disabled by Include/Exclude setting.
ASIO: channel format: 19
ASIO: Latencies: in = 480, out = 960
ASIO: 480->480, 480, 480
ASIO: starting
ASIO: found ASIO Fireface
ASIO: found Maschine MK3
ASIO: found Steinberg built-in ASIO Driver
ASIO: found Yamaha Steinberg USB ASIO