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

LADSPA Caps Amp effect crash when FPE debugging enabled #5882

Open
Veratil opened this issue Jan 17, 2021 · 3 comments
Open

LADSPA Caps Amp effect crash when FPE debugging enabled #5882

Veratil opened this issue Jan 17, 2021 · 3 comments
Labels

Comments

@Veratil
Copy link
Contributor

Veratil commented Jan 17, 2021

Bug Summary

When loading any demo projects containing the LADSPA CAPS Amp effect, LMMS crashes.

Steps to reproduce

  1. Build master with FPE debugging enabled
  2. Run LMMS
  3. Load a demo project (for example demos/CapDan/CapDan-TwilightArea-OriginalByAlf42red.mmpz)

Expected behavior

LMMS loads the demo project

Actual behavior

LMMS crashes during load of demo project

Affected LMMS versions

LMMS 1.3.0-alpha.1.65+g623e35ca2
Unknown how further back this crash affects.

Logs

@PhysSong and myself start searching for clues starting here: discord message of gdb backtrace
I tracked it back to this line.
Following that @PhysSong tracked down an update fixing the function in CAPS 0.9.25.

Small backport of the function and I can load demos successfully.

diff --git a/plugins/LadspaEffect/caps/dsp/windows.h b/plugins/LadspaEffect/caps/dsp/windows.h
index 949a95818..44a4cd734 100644
--- a/plugins/LadspaEffect/caps/dsp/windows.h
+++ b/plugins/LadspaEffect/caps/dsp/windows.h
@@ -142,13 +142,14 @@ kaiser (sample_t * s, int n, double beta)
        double bb = besseli (beta);
        int si = 0;
 
-       for (double i = -n / 2 + .1; si < n; ++si, ++i)
+       for (double i = -n / 2. + .5; si < n; ++si, ++i)
        {
-               double k = besseli ((beta * sqrt (1 - pow ((2 * i / (n - 1)), 2)))) / bb;
+               double a = 1 - pow((2 * i / (n - 1)), 2);
+               double k = besseli ((beta * (a < 0 ? 0 : sqrt(a)))) / bb;
 
                /* can you spell hack */
-               if (!isfinite (k) || isnan(k))
-                       k = 0;
+               /*if (!isfinite (k) || isnan(k))
+                       k = 0;*/
 
                F (s[si], k);
        }
@Veratil Veratil added the bug label Jan 17, 2021
@PhysSong PhysSong changed the title LADSPA Caps Amp effect SIGFPE crash on master LADSPA Caps Amp effect SIGFPE crash on master when FPE debugging enabled Jan 17, 2021
@PhysSong PhysSong changed the title LADSPA Caps Amp effect SIGFPE crash on master when FPE debugging enabled LADSPA Caps Amp effect crash when FPE debugging enabled Jan 17, 2021
@CLandel89
Copy link
Contributor

CLandel89 commented Jul 4, 2022

Enabling FPE debugging (-DWANT_DEBUG_FPE=true) causes A LOT of trouble.
I'm on a current KUbuntu 22.04, and current master yields this console output when I compile it with FPE debugging and try to add a Monstro or Sample as a track:

user@christian:~$ /opt/lmms-220704-9705/bin/lmms
*** WEAK-JACK: initializing
*** WEAK-JACK: OK. (0)
Notice: could not set realtime priority.
Failed to allocate shared memory for VST sync: SharedMemoryImpl: shm_open() failed: Die Datei existiert bereits
Lv2 plugin SUMMARY: 11 of 29  loaded in 12 msecs.
For details about not loaded plugins, please set
  environment variable "LMMS_LV2_DEBUG" to nonempty.
Connection established.

Die Bibliothek /opt/lmms-220704-9705/lib/lmms/libcarlabase.so kann nicht geladen werden: (libcarla_native-plugin.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
Die Bibliothek /opt/lmms-220704-9705/lib/lmms/libcarlarack.so kann nicht geladen werden: (libcarlabase.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
Die Bibliothek /opt/lmms-220704-9705/lib/lmms/libcarlapatchbay.so kann nicht geladen werden: (libcarlabase.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
Stream successfully created

/opt/lmms-220704-9705/bin/lmms(_Z13signalHandleri+0x2f)[0x56286ad78958]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fb9ef4a5520]
/lib/x86_64-linux-gnu/libQt5Gui.so.5(_ZN10QBasicDrag9startDragEv+0x35)[0x7fb9f00a1215]
/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5(+0x88eca)[0x7fb9eb6ebeca]
/lib/x86_64-linux-gnu/libQt5Gui.so.5(_ZN10QBasicDrag4dragEP5QDrag+0x22)[0x7fb9f009ff92]
/lib/x86_64-linux-gnu/libQt5Gui.so.5(_ZN12QDragManager4dragEP5QDrag+0x129)[0x7fb9f009d3e9]
/lib/x86_64-linux-gnu/libQt5Gui.so.5(_ZN5QDrag4execE6QFlagsIN2Qt10DropActionEES2_+0x7f)[0x7fb9f009d73f]
/opt/lmms-220704-9705/bin/lmms(_ZN4lmms3gui14StringPairDragC2ERK7QStringS4_RK7QPixmapP7QWidget+0x272)[0x56286af169d2]
/opt/lmms-220704-9705/bin/lmms(_ZN4lmms3gui16PluginDescWidget15mousePressEventEP11QMouseEvent+0xbc)[0x56286af09594]
/lib/x86_64-linux-gnu/libQt5Widgets.so.5(_ZN7QWidget5eventEP6QEvent+0x20e)[0x7fb9f10d44ee]
lmms: /home/user/lmms-git/src/3rdparty/rpmalloc/rpmalloc/rpmalloc/rpmalloc.c:1328: _rpmalloc_span_finalize: Zusicherung »(span->list_size == span->used_count) && "Memory leak detected"« nicht erfüllt.
Abgebrochen (Speicherabzug geschrieben)

@zonkmachine
Copy link
Member

Enabling FPE debugging (-DWANT_DEBUG_FPE=true) causes A LOT of trouble.

As it's supposed to. It's for hard core troubleshooting. We test for issues that the user wouldn't have noticed if we fixed or not. You would not have this option enabled on a daily basis.

@zonkmachine
Copy link
Member

zonkmachine commented Apr 16, 2024

Following that @PhysSong tracked down an update fixing the function in CAPS 0.9.25.

I can confirm the fix. @Veratil I suggest you merge the patch above as a temporary fix until the caps submodule is done.

Edit: The update message in CAPS 0.9.25 is somewhat intriguing.


0.9.25
  * potential gcc overoptimisation resulting in NaN in Kaiser window setup eliminated
    (fix contributed by Jean Pierre Cimalando)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants