You are here

SIGBUS in drumkv1...

This is the first time I tried using drumkv1.
I built drumkv1 from today's git HEAD 80d65c41
I loaded one sample (a snare drum)

Connected MIDI Out from Qtractor to drumkv1 MIDI in.
Started play in Qtractor.
When the first snare note is sent, drumkv1 crashed.
This behavior happens every time I try it (5 times now).

I rebuilt it with --enable-debug.
Here's the backtrace:

$ gdb /usr/local/bin/drumkv1_jack 
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/drumkv1_jack...done.
(gdb) run
Starting program: /usr/local/bin/drumkv1_jack 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeaadb700 (LWP 18353)]
[New Thread 0x7fffe9e83700 (LWP 18354)]
[New Thread 0x7fffe9682700 (LWP 18355)]
[New Thread 0x7fffe8e46700 (LWP 18358)]
[New Thread 0x7fffe85c4700 (LWP 18359)]
drumkv1widget::activateElement(36)
drumkv1widget::updateSchedNotify(0, 0x0000)
drumkv1widget::loadPreset("/home/genie/sub/studio/drumkv1/test.drumkv1")
drumkv1widget::clearSampleFile()
drumkv1widget::activateElement(36)
drumkv1widget::updateSchedNotify(0, 0x0000)
drumkv1widget::updateSchedNotify(4, 0xffffffff)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(3, 0x0000)
drumkv1widget::updateSchedNotify(4, 0xffffffff)
drumkv1widget::updateSchedNotify(3, 0x0000)

Program received signal SIGBUS, Bus error.
[Switching to Thread 0x7fffe85c4700 (LWP 18359)]
0x00007ffff7230a3c in drumkv1_formant::Impl::vtab_coeffs(drumkv1_formant::Coeffs&, drumkv1_formant::Vtab const*, unsigned int, float) () from /usr/local/lib/libdrumkv1.so.0
(gdb) bt
#0  0x00007ffff7230a3c in drumkv1_formant::Impl::vtab_coeffs(drumkv1_formant::Coeffs&, drumkv1_formant::Vtab const*, unsigned int, float) () from /usr/local/lib/libdrumkv1.so.0
#1  0x00007ffff7230bf8 in drumkv1_formant::Impl::reset_coeffs() () from /usr/local/lib/libdrumkv1.so.0
#2  0x00007ffff7230cfe in drumkv1_formant::reset_coeffs() () from /usr/local/lib/libdrumkv1.so.0
#3  0x00007ffff7226682 in drumkv1_formant::update (this=0x65f768, cutoff=100, reso=0) at drumkv1_formant.h:234
#4  0x00007ffff7226377 in drumkv1_formant::reset_filters (this=0x65f768, cutoff=100, reso=0) at drumkv1_formant.h:121
#5  0x00007ffff7221134 in drumkv1_impl::process_midi (this=0x662cc0, data=0x7fffe85c39d0 "\231&C\004\002", size=3) at drumkv1.cpp:1512
#6  0x00007ffff7223df9 in drumkv1::process_midi (this=0x65b8a0, data=0x7fffe85c39d0 "\231&C\004\002", size=3) at drumkv1.cpp:2231
#7  0x000000000040a2e5 in drumkv1_jack::process (this=0x65b8a0, nframes=128) at drumkv1_jack.cpp:271
#8  0x0000000000409b44 in drumkv1_jack_process (nframes=128, arg=0x65b8a0) at drumkv1_jack.cpp:112
#9  0x00007ffff795ce2f in ?? () from /usr/lib/x86_64-linux-gnu/libjack.so.0
#10 0x00007ffff51a6064 in start_thread (arg=0x7fffe85c4700) at pthread_create.c:309
#11 0x00007ffff46b962d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) 

I don't know why the bt doesn't have line numbers for the functions in libdrumkv1.so, maybe because I didn't do make clean before ./configure --enable-debug

Anyway, even without exact line number, my guess is m_srate is 0, here:

	const float Ri = ::expf(-M_PI * Bi / m_srate);
Forums: 

Oh, I forgot, one possibly useful clue:
I noticed that when connecting jack audio outs of drumkv1 to system.playback ins, it (both qjackctl and qtractor connections) refused to connect drumkv1.out_2 to system.playback_2. It drew the connection line and then a fraction of a second later erased the line. This also happens every time.

One time it emitted this message:
cannot complete execution of the processing graph (Resource temporarily unavailable)
jack_client_thread: graph error - exiting from JACK
but I think that time it crashed with SIGSEGV. This was before I build it with debug

After trying it again, this time I see a SIGSEGV, in same function.

(gdb) run
Starting program: /usr/local/bin/drumkv1_jack 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeaadb700 (LWP 18541)]
[New Thread 0x7fffe9e83700 (LWP 18542)]
[New Thread 0x7fffe9682700 (LWP 18543)]
[New Thread 0x7fffe8e46700 (LWP 18546)]
[New Thread 0x7fffe85c4700 (LWP 18547)]
drumkv1widget::activateElement(36)
drumkv1widget::updateSchedNotify(0, 0x0000)
drumkv1widget::loadPreset("/home/genie/sub/studio/drumkv1/test.drumkv1")
drumkv1widget::clearSampleFile()
drumkv1widget::activateElement(36)
drumkv1widget::updateSchedNotify(0, 0x0000)
drumkv1widget::activateElement(38)
drumkv1widget::updateSchedNotify(0, 0x0000)
[New Thread 0x7fffdab37700 (LWP 18823)]
[Thread 0x7fffdab37700 (LWP 18823) exited]
drumkv1widget::loadSampleFile("/home/genie/.hydrogen/data/drumkits/Buendia GM kit/Snare_B_03_1.wav")

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe85c4700 (LWP 18547)]
0x00007ffff7230a3c in drumkv1_formant::Impl::vtab_coeffs(drumkv1_formant::Coeffs&, drumkv1_formant::Vtab const*, unsigned int, float) () from /usr/local/lib/libdrumkv1.so.0
(gdb) bt
#0  0x00007ffff7230a3c in drumkv1_formant::Impl::vtab_coeffs(drumkv1_formant::Coeffs&, drumkv1_formant::Vtab const*, unsigned int, float) () from /usr/local/lib/libdrumkv1.so.0
#1  0x00007ffff7230bf8 in drumkv1_formant::Impl::reset_coeffs() () from /usr/local/lib/libdrumkv1.so.0
#2  0x00007ffff7230cfe in drumkv1_formant::reset_coeffs() () from /usr/local/lib/libdrumkv1.so.0
#3  0x00007ffff7226682 in drumkv1_formant::update (this=0x686968, cutoff=3.125, reso=0) at drumkv1_formant.h:234
#4  0x00007ffff7226377 in drumkv1_formant::reset_filters (this=0x686968, cutoff=3.125, reso=0) at drumkv1_formant.h:121
#5  0x00007ffff7221134 in drumkv1_impl::process_midi (this=0x65b9c0, 
    data=0x7fffe85c39d0 "\231&LSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377", size=3) at drumkv1.cpp:1512
#6  0x00007ffff7223df9 in drumkv1::process_midi (this=0x65b830, 
    data=0x7fffe85c39d0 "\231&LSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377", size=3) at drumkv1.cpp:2231
#7  0x000000000040a2e5 in drumkv1_jack::process (this=0x65b830, nframes=128) at drumkv1_jack.cpp:271
#8  0x0000000000409b44 in drumkv1_jack_process (nframes=128, arg=0x65b830) at drumkv1_jack.cpp:112
#9  0x00007ffff795ce2f in ?? () from /usr/lib/x86_64-linux-gnu/libjack.so.0
#10 0x00007ffff51a6064 in start_thread (arg=0x7fffe85c4700) at pthread_create.c:309
#11 0x00007ffff46b962d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
rncbc's picture

reading from the above dump... hmm...
how come the "cutoff" filter parameter has a 3.125 value? the maximum sane value is 1.0.
i guess that's one suspect that some parameters values are borked if not the whole preset :/
you seem to be loading a "test.drumkv1" preset file: can you check if all the parameters have sane values, especially the ones named after DCF1_CUTOFF ?

cheers

preset version="0.5.1" name="test"

index="0" name="GEN1_SAMPLE" 38
index="1" name="GEN1_REVERSE" 0
index="2" name="GEN1_GROUP" 0
index="3" name="GEN1_COARSE" 0
index="4" name="GEN1_FINE" 0
index="5" name="GEN1_ENVTIME" 100
index="6" name="DCF1_CUTOFF" 100
index="7" name="DCF1_RESO" 0
index="8" name="DCF1_TYPE" 0
index="9" name="DCF1_SLOPE" 0
index="10" name="DCF1_ENVELOPE" 100
index="11" name="DCF1_ATTACK" 0
index="12" name="DCF1_DECAY1" 100
index="13" name="DCF1_LEVEL2" 100
index="14" name="DCF1_DECAY2" 100
index="15" name="LFO1_SHAPE" 1
index="16" name="LFO1_WIDTH" 100
index="17" name="LFO1_RATE" 100
index="18" name="LFO1_SWEEP" 0
index="19" name="LFO1_PITCH" 0
index="20" name="LFO1_CUTOFF" 0
index="21" name="LFO1_RESO" 0
index="22" name="LFO1_PANNING" 0
index="23" name="LFO1_VOLUME" 0
index="24" name="LFO1_ATTACK" 0
index="25" name="LFO1_DECAY1" 100
index="26" name="LFO1_LEVEL2" 100
index="27" name="LFO1_DECAY2" 100
index="28" name="DCA1_VOLUME" 100
index="29" name="DCA1_ATTACK" 0
index="30" name="DCA1_DECAY1" 100
index="31" name="DCA1_LEVEL2" 100
index="32" name="DCA1_DECAY2" 100
index="33" name="OUT1_WIDTH" 0
index="34" name="OUT1_PANNING" 0
index="35" name="OUT1_VOLUME" 0.7




index="36" name="DEF1_PITCHBEND" 100
index="37" name="DEF1_MODWHEEL" 100
index="38" name="DEF1_PRESSURE" 100
index="39" name="DEF1_VELOCITY" 100
index="40" name="DEF1_CHANNEL" 10
index="41" name="DEF1_NOTEOFF" 0
index="42" name="CHO1_WET" 0
index="43" name="CHO1_DELAY" 100
index="44" name="CHO1_FEEDB" 100
index="45" name="CHO1_RATE" 100
index="46" name="CHO1_MOD" 100
index="47" name="FLA1_WET" 0
index="48" name="FLA1_DELAY" 100
index="49" name="FLA1_FEEDB" 100
index="50" name="FLA1_DAFT" 0
index="51" name="PHA1_WET" 0
index="52" name="PHA1_RATE" 100
index="53" name="PHA1_FEEDB" 100
index="54" name="PHA1_DEPTH" 100
index="55" name="PHA1_DAFT" 0
index="56" name="DEL1_WET" 0
index="57" name="DEL1_DELAY" 100
index="58" name="DEL1_FEEDB" 100
index="59" name="DEL1_BPM" 180
index="60" name="DEL1_BPMSYNC" 0
index="61" name="DEL1_BPMHOST" 180
index="62" name="REV1_WET" 100
index="63" name="REV1_ROOM" 100
index="64" name="REV1_DAMP" 100
index="65" name="REV1_FEEDB" 100
index="66" name="REV1_WIDTH" 0
index="67" name="DYN1_COMPRESS" 0
index="68" name="DYN1_LIMITER" 1
rncbc's picture

preset version="0.5.1" ?? last time you ran drumkv1 it was almost four (4) years ago?
i'm afraid things just aren't so backwards compatible nowadays :)
please try to get rid of the ancient configuration file ~/.config/rncbc.org/drumkv1.conf and start again.
hth.
cheers

cutoff=3.125 doesn't appear to have come from the preset file, the value there is 100, as shown in my previous message.

The drumkv1.conf looks OK to me:

[Custom]
StyleTheme=

[Default]
ControlsEnabled=false
KnobDialMode=0
KnobEditMode=0
Preset=test
PresetDir=/studio/drumkv1
ProgramsEnabled=false
SampleDir=/studio/drumkits/Buendia GM kit
UseGMDrumNames=true

[Dialogs]
ProgramsPreview=false
UseNativeDialogs=true

[Presets]
test=/studio/drumkv1/test.drumkv1

[Program]
Version=0.8.6.16git.80d65c

In any case, a program shouldn't crash simply because it was fed some unexpected data.

Because sometimes it crashes with SIGBUS, and other times with SIGSEGV, that indicates to me there is some memory corrupted, i.e. bad pointer or buffer overflow somewhere. Corrupt m_srate to 0, and later you get a SIGBUS. Corrupt some index or pointer, later you get a SIGSEGV.
Maybe the cutoff=3.125 also came from someone scribbling in memory they shouldn't have.

rncbc's picture

your .conf file have these lines that are causing it to load an outdated preset file on every startup:

[Default]
Preset=test
...
[Presets]
test=/studio/drumkv1/test.drumkv1

have you tried as said before? or you can just remove the lines above from the .conf, it serves either way to the purpose at hand.

byee

Add new comment