AIMP Forum

AIMP for PC => Ошибки и замечания / Bugs => Topic started by: Elar on August 06, 2026, 21:57:36

Title: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Elar on August 06, 2026, 21:57:36
SUMMARY

On the native Linux build of AIMP 6.0 Beta, opening the Preferences window causes the application to freeze indefinitely (low but constant CPU usage, ~2-4%) while spamming the following error in the console, forever, without ever completing or timing out:

Code: [Select]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Expression 'AlsaOpen( hostApi, parameters, streamDir, &pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1768

Root cause identified: the freeze is directly tied to the audio output device being set to DeviceName=PortAudio: default in aimp.ini. This value also caused complete silence during playback (no sound through speakers or headphones), despite PipeWire/ALSA working correctly outside AIMP (confirmed with speaker-test and paplay).

Fix that resolved both issues simultaneously: manually editing aimp.ini and changing:

Code: [Select]
[AIMPSoundOut]
DeviceName=PortAudio: default

to:

Code: [Select]
[AIMPSoundOut]
DeviceName=PortAudio: pulse

After this change, both problems disappeared:


This suggests that when DeviceName is set to default, AIMP/PortAudio's ALSA host API attempts to enumerate and probe every raw ALSA hardware endpoint on the system (not just the ones actually usable), gets stuck retrying a device that is permanently held exclusively by PipeWire, and never falls back or times out — hanging the whole Preferences dialog. When the device is explicitly pulse, this raw enumeration/probing step appears to be skipped or handled correctly.

System info


Steps to reproduce

1. Install AIMP 6.0 Beta native for Linux on a system using PipeWire, with an Intel SOF soundwire audio card exposing multiple ALSA subdevices (common on modern Intel laptops).

2. Leave DeviceName=PortAudio: default in aimp.ini (default/typical value).

3. Launch AIMP and try to play a track — no audio output at all, despite the underlying system audio stack working correctly.

4. Open Preferences — the window becomes fully unresponsive. Console output floods indefinitely with:

Code: [Select]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
    Expression 'AlsaOpen( hostApi, parameters, streamDir, &pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1768

This repeats forever; waiting several minutes does not resolve it. CPU usage stays low (~2-4%), so it's a retry loop, not a hard deadlock.

5. Force-kill the process (killall -9 AIMP).

6. Close AIMP, manually edit aimp.ini, change DeviceName=PortAudio: default to DeviceName=PortAudio: pulse.

7. Relaunch AIMP — audio plays correctly, and Preferences opens without any freeze.

Expected behavior

Additional notes
Title: Re: Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Artem on August 07, 2026, 14:55:14
Open Preferences — the window becomes fully unresponsive. Console output floods indefinitely with:

Can you provide to me console output with the AIMP's entry points too? I’m not very clear on exactly which stage the problem occurs.
Title: Re: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Artem on August 07, 2026, 15:01:41
Fix that resolved both issues simultaneously: manually editing aimp.ini and changing:

Does the "ALSA: default" works as expected? May be an issue of PortAudio?
Title: Re: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Elar on August 07, 2026, 17:55:57
I managed to reproduce the freeze again with full logging and captured a crash report.

1) Console output:

Here's the relevant excerpt from AIMP.log, from a fresh launch through to the point where the crash loop starts:

Code: [Select]
Main    D/Main: LoadSettings2
Main    D/ASO:  Device.DeviceReinitialize
Main    D/Main: InitDone
...
Main    D/Main: ApplySkin(A4.acs6)
Main    D/Main: WindowShow
...
Main    E/Main: [EExternalException] Fatal exception at 70EA786ECBDF
--------------------------------------------------------------------------
[libc.so.6] nanosleep
[libportaudio.so.2.0.0] Pa_Sleep
[libportaudio.so.2.0.0] PaAlsa_SetRetriesBusy
[libportaudio.so.2.0.0] Pa_Sleep
[libportaudio.so.2.0.0] PaAlsa_SetNumPeriods
[libportaudio.so.2.0.0] Pa_IsFormatSupported
[AIMP] ASO.Devices.PortAudio.pas.TPortAudioDeviceFormatEnumerator.IsSupported at line 258
[AIMP] ASO.Devices.pas.TASODeviceFormatsEnumerator.TestSampleFormats at line 497
[AIMP] ASO.Devices.pas.TASODeviceFormatsEnumerator.Populate at line 413
[AIMP] ASO.Devices.pas.TASODevice.GetFormats at line 682
[AIMP] AIMPOptionFrameSoundOutUtils.pas.TASOSettingsSampleFormatComboboxHelper.Populate at line 433
[AIMP] AIMPOptionFrameSoundOutUtils.pas.TASOSettingsCustomComboboxHelper.Validate at line 227
[AIMP] AIMPOptionFrameSoundOut.pas.TAIMPOptionsFrameSoundOut.cbDeviceParamSelect at line 267
...
[AIMP] AIMPOptionFrameSoundOut.pas.TAIMPOptionsFrameSoundOut.cbDeviceSelect at line 319
...
[AIMP] AIMPOptionFrameSoundOut.pas.TAIMPOptionsFrameSoundOut.LoadConfig at line 207
[AIMP] AIMPOptionsDialogClasses.pas.TAIMPOptionsDialogCustomFrameWindow.InternalLoadCore at line 303
...
[AIMP] AIMPOptionsDialog.pas.ExecuteOptions at line 195
[AIMP] AIMPMainHelper.pas.TAIMPMainFormHelper.HostCommands at line 1017

This repeated 3 times in a row (once per ~14 seconds) while the Preferences window was open and unresponsive, before I force-killed the process.

2) ALSA: default or  PortAudio:

The stack trace confirms this is specifically PortAudio's ALSA host API (PaAlsa_SetRetriesBusy / PaAlsa_SetNumPeriods / Pa_IsFormatSupported) getting stuck while enumerating supported sample formats/rates for the PortAudio: default device, triggered by TAIMPOptionsFrameSoundOut.cbDeviceSelect → LoadConfig when the Preferences dialog populates the Sample Format and Sample Rate dropdowns.

I don't see a separate "ALSA: default" entry distinct from PortAudio in my device list — in my build, PortAudio: default and PortAudio: pulse are the two relevant entries, and the crash only occurs with default. Switching to PortAudio: pulse (in aimp.ini, since the UI itself can't be reached while default is selected) resolves both the freeze and the total audio silence I was experiencing.

System for reference: Intel SOF/soundwire audio card, PipeWire sound server, KDE Plasma 6.6.5 on Wayland (also reproduced identically under XWayland via GDK_BACKEND=x11, and with PipeWire fully stopped — so it's not simply exclusive-device contention, the enumeration itself never completes/never fails gracefully for this device).
Title: Re: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Artem on August 10, 2026, 16:47:50
I managed to reproduce the freeze again with full logging and captured a crash report.

1) Console output:

Here's the relevant excerpt from AIMP.log, from a fresh launch through to the point where the crash loop starts:

Nevertheless, I need the full log from the player, not just the trimmed version. It will indicate the version being used, as well as the parameters with which the player attempted to query the devices.

getting stuck while enumerating

FatalException maps to SIGABRT signal that tells that something goes wrong on ALSA-backend on side of the PortAudio library. Usually, it should return an error code instead of throw the exception.

I don't see a separate "ALSA: default"

As I say upper, I need full log from the app. ALSA is default output for Linux. If the ALSA configuration is missing or damaged, this would explain why PortAudio crashes.
Title: Re: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Elar on August 20, 2026, 12:44:50
I can no longer provide logs, sorry. I had to change the operating system, with the one I use now there is no problem anymore.
Title: Re: [?] Bug Report: Preferences window freezes / infinite ALSA enumeration loop
Post by: Artem on August 20, 2026, 12:49:32
Ок