Skip to content

Try to fix ASIO4ALL hang - #3862

Closed
ann0see wants to merge 2 commits into
jamulussoftware:mainfrom
ann0see:fix/3779-asio-hang-device-change
Closed

Try to fix ASIO4ALL hang#3862
ann0see wants to merge 2 commits into
jamulussoftware:mainfrom
ann0see:fix/3779-asio-hang-device-change

Conversation

@ann0see

@ann0see ann0see commented Aug 6, 2026

Copy link
Copy Markdown
Member

Short description of changes

Draft PR narrowing lock and adding guard. Needs testing and human review. Authorship will be changed once I'm more comfortable.

CHANGELOG: Windows: Fix hang on ASIO4ALL

Context: Fixes an issue?

Fixes: #3779

Does this change need documentation? What needs to be documented and how?

No

Status of this Pull Request

PoC

What is missing until this pull request can be merged?

Review and Windows tests

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

AUTOBUILD: Please build all targets

@ann0see ann0see added this to Tracking Aug 6, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Aug 6, 2026
@ann0see ann0see added the AI AI generated or potentially AI generated label Aug 6, 2026
@ann0see ann0see self-assigned this Aug 6, 2026
@ann0see
ann0see marked this pull request as ready for review August 6, 2026 20:22
@ann0see ann0see added this to the Release 4.0.0 milestone Aug 6, 2026
@ann0see
ann0see marked this pull request as draft August 6, 2026 20:23
@ann0see

ann0see commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

There's something weird going on with the CI. Unsure why the CI does not run

Comment thread src/sound/asio/sound.cpp
// outside the mutex: a driver may block inside them until its audio thread
// returns from bufferSwitch(), which would deadlock if the mutex were held
// here (see issue #3779)
ASIOMutex.lock(); // get mutex lock

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this exists, but a syntax like lock {.Init()} would be good. Otherwise also we could have a look at the .Init function to add the lock there - maybe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the separate lock and unlock, you could always do:

{
  QMutexLocker locker ( &ASIOMutex );
  vecsMultChanAudioSndCrd.Init ( iASIOBufferSizeStereo );
}

That would also unlock if Init() threw an exception.

Comment thread src/sound/asio/sound.cpp
// if we are not running, ignore any stray callback (e.g. from ASIO4ALL's
// emulation thread during Init()/teardown) so that it cannot block on
// ASIOMutex which is owned by the re-init thread (see issue #3779)
if ( !pSound->bRun )

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if this is not needed - I suspect it not being problematic to add

@ann0see

ann0see commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Local reproduction shows that this is not yet fixed.

@ann0see

ann0see commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Closing as does not fix issue.

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

Labels

AI AI generated or potentially AI generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate Windows Hang if using ASIO4ALL especially

3 participants