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

calf-limiter segfault #188

Closed
trebmuh opened this issue Aug 11, 2018 · 10 comments
Closed

calf-limiter segfault #188

trebmuh opened this issue Aug 11, 2018 · 10 comments

Comments

@trebmuh
Copy link
Contributor

trebmuh commented Aug 11, 2018

Trying to use the calf-limiter from 0.90.1 on a debian stretch gives me a segfault:

$ jalv -s http://calf.sourceforge.net/plugins/Limiter
Plugin:       http://calf.sourceforge.net/plugins/Limiter
UI:           http://calf.sourceforge.net/plugins/gui/gtk2-gui
JACK Name:    Calf Limiter
Sample rate:  48000 Hz
Block length: 256 frames
MIDI buffers: 32768 bytes
Comm buffers: 524288 bytes
Update rate:  25.0 Hz

segfault

Tried with calf-limiter from 0.90.0, same.

Note:

  • the multiband limiter and sidechain limiter do work
  • trying the limiter in Ardour 5.12 and/or Qtractor 0.9.1 do work
@falkTX
Copy link
Collaborator

falkTX commented Aug 11, 2018

is this not a bug with jalv?
other hosts work fine. what about jalv.gtk ?

@trebmuh
Copy link
Contributor Author

trebmuh commented Aug 11, 2018

jalv.gtk gives the same result than jalv -s (ie : segfault).

For information, jalv version is 1.6.0~dfsg0-2.

Edit: note that it is working as expected with calfjackhost so, as suggested by @falkTX , it seems that I'm heading towards a jalv bug here.

@jpcima
Copy link
Contributor

jpcima commented Aug 11, 2018

I also have this problem, and I can complete this report with some trace information.

Under limiter_audio_module::set_rates here is the location of the crash.
It's the access into the value of the parameter oversampling.

resampler[0].set_params(srate, *params[param_oversampling], 2);

One level up in the call stack, it can be observed to arise from a set_sample_rate call located here.

void limiter_audio_module::set_sample_rate(uint32_t sr)
{
srate = sr;
int meter[] = {param_meter_inL, param_meter_inR, param_meter_outL, param_meter_outR, -param_att};
int clip[] = {param_clip_inL, param_clip_inR, param_clip_outL, param_clip_outR, -1};
meters.init(params, meter, clip, 5, srate);
set_srates();
}

@boomshop
Copy link
Member

Problem is: I'm unable to install jalv atm. So if anyone could help out with a full gdb trace it would be helpful.

@jpcima
Copy link
Contributor

jpcima commented Aug 11, 2018

@boomshop here's detailed information from a core dump and debug-enabled calf 962ad67
I do a print command at the bottom, you can observe the array of parameters as being full of null values.

Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `jalv -s http://calf.sourceforge.net/plugins/Limiter'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  calf_plugins::limiter_audio_module::set_srates (this=0x5576e0383700) at modules_limit.cpp:62
62	    resampler[0].set_params(srate, *params[param_oversampling], 2);
[Current thread is 1 (Thread 0x7f5000535640 (LWP 13446))]
(gdb) bt
#0  calf_plugins::limiter_audio_module::set_srates (this=0x5576e0383700) at modules_limit.cpp:62
#1  0x00007f4ff6905370 in calf_plugins::limiter_audio_module::set_sample_rate (
    this=0x5576e0383700, sr=48000) at modules_limit.cpp:90
#2  0x00007f4ff68cc947 in calf_plugins::lv2_instance::impl_restore (this=0x5576e0383d80, 
    retrieve=0x7f5001942000, callback_data=0x5576e03341d0) at lv2wrap.cpp:90
#3  0x00007f4ff69764ca in calf_plugins::lv2_wrapper<calf_plugins::limiter_audio_module>::cb_state_restore (Instance=0x5576e0383d80, retrieve=0x7f5001942000, callback_data=0x5576e03341d0, flags=0, 
    features=0x5576e0393f10) at ./calf/lv2wrap.h:254
#4  0x00007f50019437c8 in lilv_state_restore () from /usr/lib/liblilv-0.so.0
#5  0x00005576defdab5f in ?? ()
#6  0x00007f5000d01003 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x00005576defdb07a in ?? ()
(gdb) p params
$1 = {0x0 <repeats 19 times>}

@boomshop
Copy link
Member

Could you please check the latest git version? 189f5ae is an attempt to fix this issue.

@jpcima
Copy link
Contributor

jpcima commented Aug 12, 2018

Nope, it's the same problem still. In fact, it does not seem to reach as far as this part of code.
I've printed some traces on the console to check.

However it breaks the compilation and needs small change

error: no matching function for call to 'max(int, uint32_t&)'

-    srate   = std::max(2, sr);
+    srate   = std::max(2u, sr);

@jpcima
Copy link
Contributor

jpcima commented Aug 12, 2018

Here's details of bizarre things which happen.
It's when parameters appear to get its NULL pointers. I've printed in two places.

calf-limiter-trace.diff.gz

Plugin:       http://calf.sourceforge.net/plugins/Limiter
UI:           http://calf.sourceforge.net/plugins/gui/gtk2-gui
JACK Name:    Calf Limiter
Sample rate:  48000 Hz
Block length: 256 frames
MIDI buffers: 32768 bytes
Comm buffers: 524288 bytes
Update rate:  25,0 Hz
[lv2_wrapper] connect port 0 to data (nil)
[lv2_wrapper] connect port 1 to data (nil)
[lv2_wrapper] connect port 2 to data (nil)
[lv2_wrapper] connect port 3 to data (nil)
[lv2_wrapper] connect port 4 to data (nil)
[lv2_wrapper] connect port 5 to data (nil)
[lv2_wrapper] connect port 6 to data (nil)
[lv2_wrapper] connect port 7 to data (nil)
[lv2_wrapper] connect port 8 to data (nil)
[lv2_wrapper] connect port 9 to data (nil)
[lv2_wrapper] connect port 10 to data (nil)
[lv2_wrapper] connect port 11 to data (nil)
[lv2_wrapper] connect port 12 to data (nil)
[lv2_wrapper] connect port 13 to data (nil)
[lv2_wrapper] connect port 14 to data (nil)
[lv2_wrapper] connect port 15 to data (nil)
[lv2_wrapper] connect port 16 to data (nil)
[lv2_wrapper] connect port 17 to data (nil)
[lv2_wrapper] connect port 18 to data (nil)
[lv2_wrapper] connect port 19 to data (nil)
[lv2_wrapper] connect port 20 to data (nil)
[lv2_wrapper] connect port 21 to data (nil)
[lv2_wrapper] connect port 22 to data (nil)
[lv2_wrapper] connect port 23 to data (nil)
[lv2_wrapper] connect port 24 to data (nil)

[lv2_wrapper] connect port 23 to data 0x55fdf7faedd0
[lv2_wrapper] connect port 24 to data 0x55fdf7fb6e10
[limiter_audio_module::set_srates] port 0 data at (nil)
[limiter_audio_module::set_srates] port 1 data at (nil)
[limiter_audio_module::set_srates] port 2 data at (nil)
[limiter_audio_module::set_srates] port 3 data at (nil)
[limiter_audio_module::set_srates] port 4 data at (nil)
[limiter_audio_module::set_srates] port 5 data at (nil)
[limiter_audio_module::set_srates] port 6 data at (nil)
[limiter_audio_module::set_srates] port 7 data at (nil)
[limiter_audio_module::set_srates] port 8 data at (nil)
[limiter_audio_module::set_srates] port 9 data at (nil)
[limiter_audio_module::set_srates] port 10 data at (nil)
[limiter_audio_module::set_srates] port 11 data at (nil)
[limiter_audio_module::set_srates] port 12 data at (nil)
[limiter_audio_module::set_srates] port 13 data at (nil)
[limiter_audio_module::set_srates] port 14 data at (nil)
[limiter_audio_module::set_srates] port 15 data at (nil)
[limiter_audio_module::set_srates] port 16 data at (nil)
[limiter_audio_module::set_srates] port 17 data at (nil)
[limiter_audio_module::set_srates] port 18 data at (nil)
zsh: segmentation fault (core dumped)  LV2_PATH=/opt/calf/lib/lv2 jalv.gtk 

@jpcima
Copy link
Contributor

jpcima commented Aug 12, 2018

I think the set_srates thing must wait until the plugin will be activated to be done.
It's not a guarantee that parameters will be connected at the time of set_sample_rate.

@trebmuh
Copy link
Contributor Author

trebmuh commented Aug 14, 2018

Tested from a fresh git build (85c4e4e) and the limiter is starting and working great with jalv.

Awesome guys, kudos!

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

No branches or pull requests

4 participants