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

Ableton crashes at startup when ASIO4ALL is also installed #86

Open
motorboyxx opened this issue Aug 16, 2020 · 6 comments
Open

Ableton crashes at startup when ASIO4ALL is also installed #86

motorboyxx opened this issue Aug 16, 2020 · 6 comments
Labels
asiohost Relates to a specific ASIO Host Application. bug

Comments

@motorboyxx
Copy link

No description provided.

@dechamps dechamps changed the title Launching Ableton with FlexASIO driver and configuration file causes crash during launch. Why? Ableton crash at startup Aug 16, 2020
@dechamps dechamps changed the title Ableton crash at startup Ableton crash at startup when using WASAPI Aug 16, 2020
@dechamps
Copy link
Owner

For reference, there's a log at #83 (comment)

--- ENTERING CONTEXT: start()
Starting PortAudio stream 00000000070946F0
[PortAudio] WASAPI: thread[ priority-0xD class-0x20 ]
[PortAudio] WASAPI ERROR HRESULT: 0x88890004 : AUDCLNT_E_DEVICE_INVALIDATED
FILE: C:\Users\edechamps\Documents\FlexASIO\src\portaudio\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 5818}]
PortAudio stream started
--- EXITING CONTEXT: start() [OK]

I've never seen PortAudio fail on start() before and it looks like there's an error handling bug on the PortAudio side where the error doesn't percolate through to FlexASIO. Most likely PortAudio ends up in a messed up state and that's what's making the process crash.

AUDCLNT_E_DEVICE_INVALIDATED is being returned from IAudioClient::Start(). Again that's the first time I see this error code. According to the relevant docs this means:

The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.

Strangely, this error starts being returned earlier, during canSampleRate() probes. The last probe to succeed is for 96 kHz at 14:22:13.850, but then the next probe for 176.4 kHz at 14:22:13.880 fails with AUDCLNT_E_DEVICE_INVALIDATED. It's really strange that it's failing all of a sudden in the middle of a probe sequence with no apparent reason. If it's the probes themselves that are causing issues, then #66 might end up fixing this problem as a side effect.

@dechamps
Copy link
Owner

Off the top of my head I can only think of two hypotheses:

  1. Ableton probing sample rates after createBuffers() somehow results in PortAudio's internal state getting messed up, causing undefined behaviour.
  2. Ableton is attempting to initialize multiple audio outputs (perhaps multiple ASIO drivers, or even multiple output methods) at the same time during startup, and the parallel initialization procedures are racing against each other, resulting in device state getting messed up.

@motorboyxx Do you have other ASIO drivers installed? If so, can you try uninstalling them and see what happens? (You can also temporarily disable a driver by deleting its registry key under HKEY_LOCAL_MACHINE\SOFTWARE\ASIO, and restore it afterwards.)

@motorboyxx
Copy link
Author

I do have ASIO4ALL installed as well. Disabling ASIO4ALL actually makes me able to launch with FlexASIO without crashing! Hopefully that will give you a clue!

@dechamps
Copy link
Owner

dechamps commented Aug 16, 2020

Okay, that actually makes some sense. If Ableton is attempting to concurrently initialize multiple ASIO drivers, then one of them might grab exclusive access to the hardware while FlexASIO is trying to probe it. This is exactly something that ASIO4ALL might do, since it uses WDM-KS internally which does imply exclusive access.

I'm not quite sure how I could make FlexASIO more resilient to this issue. Maybe it could try to detect this situation, or repeatedly retry failing PortAudio calls to try to circumvent races. I wish host applications would refrain from concurrently initializing multiple ASIO drivers at the same time - that's really playing with fire.

Until I come up with a fix, my suggestion would be to avoid having multiple ASIO drivers installed at the same time when using Ableton.

@dechamps dechamps changed the title Ableton crash at startup when using WASAPI Ableton crashes at startup when ASIO4ALL is also installed Aug 16, 2020
@dechamps dechamps added asiohost Relates to a specific ASIO Host Application. bug labels Aug 16, 2020
dechamps added a commit that referenced this issue Sep 4, 2020
@dechamps dechamps pinned this issue Sep 5, 2020
@inwardmovement
Copy link

Until I come up with a fix, my suggestion would be to avoid having multiple ASIO drivers installed at the same time when using Ableton.

Hi, I uninstalled every other ASIO drivers but still have a loud noise at Ableton startup. Do you have a definitive fix for this issue?

@dechamps
Copy link
Owner

This issue is about Ableton crashes on initialization due to racing with other ASIO drivers. What you are describing (loud noises) seems like a completely different and unrelated problem. Can you open a new issue and attach a log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asiohost Relates to a specific ASIO Host Application. bug
Projects
None yet
Development

No branches or pull requests

3 participants