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

Unable to record unless in 4/1 beats/bars #134

Closed
jwhendy opened this issue May 21, 2017 · 13 comments
Closed

Unable to record unless in 4/1 beats/bars #134

jwhendy opened this issue May 21, 2017 · 13 comments
Labels
Milestone

Comments

@jwhendy
Copy link
Contributor

jwhendy commented May 21, 2017

I get constant seg faults if I change the beats/bars to 8/1 and then try to record a sample. I'm not familiar with gdb, and my attempts to do something like gdb giada won't let it connect to jack, or running giada --debug and then gdb --pid=xxxx kills the gui. This is what I have for now:

$ giada --debug
[init] Giada 0.14.0 - Sun May 21 15:08:51 2017
[init] configuration file ready
[init] scanning midimaps directory...
[init] unable to scan midimaps directory!
[read] midimap not specified, nothing to do
[init_prepareMidiMap] MIDI map read failed!
[KA] using rtSystem 0x1
[KA] Opening devices 0 (out), 0 (in), f=48000...
[KA] 1 device(s) found
  0) system
[KA] JACK in use, freq = 48000
[pluginHost::init] initialize with buffersize=1024, samplerate=48000
[KM] using system 0x2
[KM] 1 output MIDI ports found
  0) Midi Through 14:0
[KM] 1 input MIDI ports found
  0) Midi Through 14:0
[geKeyboard::__cb_addColumn] new column added (index=0, w=380), total count=1, addColumn(x)=404
[geKeyboard::__cb_addColumn] new column added (index=1, w=380), total count=2, addColumn(x)=800
[geKeyboard::__cb_addColumn] new column added (index=2, w=380), total count=3, addColumn(x)=1196
[geKeyboard::__cb_addColumn] new column added (index=3, w=380), total count=4, addColumn(x)=1592
[geKeyboard::__cb_addColumn] new column added (index=4, w=380), total count=5, addColumn(x)=1988
[geKeyboard::__cb_addColumn] new column added (index=5, w=380), total count=6, addColumn(x)=2384
options are:
 -bg2 color
 -bg color
 -di[splay] host:n.n
 -dn[d]
 -fg color
 -g[eometry] WxH+X+Y
 -i[conic]
 -k[bd]
 -na[me] classname
 -nod[nd]
 -nok[bd]
 -not[ooltips]
 -s[cheme] scheme
 -ti[tle] windowtitle
 -to[oltips]
[KA] latency = 2048
[recorder::expand] expanded recs
[geColumn::__cb_addChannel] index = 0
[addChannel] channel index=0 added, type=1, total=1
[geKeyboard::addChannel] add to column with index = 0
[startInputRec] start input recs using chan 0 with size 384000 frame=0
Segmentation fault (core dumped)

From qjackctl messages window:

cannot read server event (Success)
cannot continue execution of the processing graph (Bad file descriptor)
graph error - calling shutdown handler
15:08:01.385 Shutdown notification.
15:08:01.385 Client deactivated.
15:08:01.386 JACK is being forced...
cannot send request type 7 to server
cannot read result for request type 7 from server (Broken pipe)
cannot send request type 7 to server
cannot read result for request type 7 from server (Broken pipe)
15:08:01.389 JACK has crashed.
15:08:01.586 JACK was stopped
15:08:22.034 JACK is starting...

#### grabbed the above, as it looked like the end of a previous crash?
### I believe he below is what corresponds to my restart of jack via qjackctl
### followed by launching giada (and the --debug output above)

15:08:22.034 /usr/bin/jackd -dalsa -dhw:PCH -r48000 -p1024 -n2 -Xraw
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=Connection refused)
attempt to connect to server failed
jackd 0.125.0
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
could not open driver .so '/usr/lib/jack/jack_firewire.so': libffado.so.2: cannot open shared object file: No such file or directory
could not open driver .so '/usr/lib/jack/jack_net.so': libcelt0.so.2: cannot open shared object file: No such file or directory
JACK compiled with System V SHM support.
loading driver ..
apparent rate = 48000
creating alsa driver ... hw:PCH|hw:PCH|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
15:08:22.052 JACK was started with PID=25649.
15:08:24.103 JACK connection change.
15:08:24.104 Server configuration saved to "/home/jwhendy/.jackdrc".
15:08:24.105 Statistics reset.
15:08:24.114 Client activated.
15:08:24.115 Patchbay deactivated.
15:08:24.124 Buffer size change (1024).
15:08:51.988 ALSA connection graph change.
15:08:52.024 JACK connection graph change.
15:08:52.205 JACK connection change.
subgraph starting at Giada timed out (subgraph_wait_fd=9, status = 0, state = Running, pollret = 0 revents = 0x0)
15:10:21.347 JACK connection graph change.
15:10:21.347 XRUN callback (1).
**** alsa_pcm: xrun of at least 119297.272 msecs
15:10:21.358 ALSA connection graph change.
15:10:21.489 JACK connection change.

This is with current git master: commit e457772aeec6f053daea569b8f70d67a7883c165.

@jwhendy
Copy link
Contributor Author

jwhendy commented May 21, 2017

Above was with jack; attached jack2 log after switching to that.
jack2-output.txt

Interestingly, with beats/bars set to 8/1, it will record for the first 4 beats and segfaults immediately after. I wondered if this was something about jack settings/buffer/available memory? Most of this audio stuff is above my head so I'm not sure what to check for!

@monocasual
Copy link
Collaborator

@jwhendy , as I wrote in #132 the bizarre segfault should be fixed for good. Can you confirm it?

@jwhendy
Copy link
Contributor Author

jwhendy commented May 29, 2017

I still get the segfault. You must have fixed something similar before, right? I was already on the latest git version when I had these issues, and it looks like the only updates since reporting this were a changelog mod and my relative path fix.

Any way I can get you more details? Or perhaps point me in the direction of a way to use gdb properly for you? Thanks!

@jwhendy
Copy link
Contributor Author

jwhendy commented May 29, 2017

Hmm. My last try with gdb didn't give me a usable interface so I couldn't set up the recording to make it crash. I was able to this time and get this:

$ gdb giada
GNU gdb (GDB) 7.12.1
### removed copyright stuff ###
This GDB was configured as "x86_64-pc-linux-gnu".
### removed help instructions ###
Reading symbols from giada...(no debugging symbols found)...done.
(gdb) run
[recorder::expand] expanded recs
[geColumn::__cb_addChannel] index = 0
[addChannel] channel index=0 added, type=1, total=1
[geKeyboard::addChannel] add to column with index = 0
[startInputRec] start input recs using chan 0 with size 352800 frame=0
Thread 17 "giada" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff02e9700 (LWP 9762)]
0x000000000042ab28 in ?? ()
(gdb) backtrace 
#0  0x000000000042ab28 in ?? ()
#1  0x00000000006bdd65 in ?? ()
#2  0x00000000006be011 in ?? ()
#3  0x00007ffff6eb226e in ?? () from /usr/lib/libjack.so.0
#4  0x00007ffff6eb1a38 in ?? () from /usr/lib/libjack.so.0
#5  0x00007ffff6ec9290 in ?? () from /usr/lib/libjack.so.0
#6  0x00007ffff69782e7 in start_thread () from /usr/lib/libpthread.so.0
#7  0x00007ffff4d5354f in clone () from /usr/lib/libc.so.6

Full log attached: giada-gdb-log.txt

@jwhendy
Copy link
Contributor Author

jwhendy commented May 29, 2017

I'm trying to remedy this, which suggests giada isn't building with debugging enabled, right?

Reading symbols from giada...(no debugging symbols found)...done.

From reading around about gdb, I should be able to show the code where the fault occurs, but at present I don't see anything like what tutorials show (also suggesting to me this isn't enabled). I'm doing things like this based on some googling around:

./configure --prefix=/usr --target=linux --enable-vst --enable-debug CFLAGS=-g CXXFLAGS="-DDEBUG -g3"

### also tried
./configure --prefix=/usr --target=linux --enable-vst --enable-debug CFLAGS="-O0 -ggdb" CXXFLAGS="-DDEBUG -O0 -ggdb"

Is that sufficient? I get a bigger resultant package by ~1MB, but I get the same "no debugging symbols found" message via gdb.

@jwhendy
Copy link
Contributor Author

jwhendy commented May 29, 2017

Bah. That was frustrating. In googling some more, the suggestion to make sure the binary wasn't stripped came up and it dawned on me that arch linux's makepkg strips before installing! Thus, gdb giada was looking at the installed binary vs. the one I build with debugging enabled. Now I get this backtrace:

$ gdb ~/path/to/local/src/giada
### mostly jack initialization stuff omitted
[recorder::expand] expanded recs
[geColumn::__cb_addChannel] index = 0
[addChannel] channel index=0 added, type=1, total=1
[geKeyboard::addChannel] add to column with index = 0
[startInputRec] start input recs using chan 0 with size 352800 frame=0

Thread 17 "giada" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff02e9700 (LWP 18448)]
0x0000000000434935 in giada::m::mixer::(anonymous namespace)::lineInRec (inBuf=0xb1be70, frame=612) at src/core/mixer.cpp:96
96		vChanInput[inputTracker]   += inBuf[frame]   * inVol;

(gdb) bt
#0  0x0000000000434935 in giada::m::mixer::(anonymous namespace)::lineInRec (inBuf=0xb1be70, frame=612) at src/core/mixer.cpp:96
#1  0x00000000004355e8 in giada::m::mixer::masterPlay (_outBuf=0xb17e50, _inBuf=0xb1be70, bufferSize=2048, streamTime=14.00163265306128, status=0, userData=0x0) at src/core/mixer.cpp:444
#2  0x0000000000774ada in RtApiJack::callbackEvent (this=0xb0abe0, nframes=1024) at src/deps/rtaudio-mod/RtAudio.cpp:2604
#3  0x00000000007730c6 in jackCallbackHandler (nframes=1024, infoPointer=0xb0ae38) at src/deps/rtaudio-mod/RtAudio.cpp:2099
#4  0x00007ffff6c9c26e in ?? () from /usr/lib/libjack.so.0
#5  0x00007ffff6c9ba38 in ?? () from /usr/lib/libjack.so.0
#6  0x00007ffff6cb3290 in ?? () from /usr/lib/libjack.so.0
#7  0x00007ffff67622e7 in start_thread () from /usr/lib/libpthread.so.0
#8  0x00007ffff4b3d54f in clone () from /usr/lib/libc.so.6

@monocasual
Copy link
Collaborator

@jwhendy sorry for the delay, we've been pretty busy with the latest release 0.14.0. Regarding the gdb call: I've been there many times! Your last output looks great, though, thanks for the effort. Giada crashes while filling vChanInput with audio data. I can confirm the bug with PulseAudio too. Investigating... 🔎

@monocasual monocasual self-assigned this Jun 2, 2017
@monocasual monocasual added the bug label Jun 2, 2017
@monocasual monocasual added this to the 0.14 series milestone Jun 2, 2017
@jwhendy
Copy link
Contributor Author

jwhendy commented Jun 2, 2017

Hmmm. So is this a pulseaudio issue? In following along with the arch wiki, I have assumed that jack and pulseaudio don't play well... I don't think it should have been running? My method for fiddling with giada has been:

pulseaudio --kill
ps ax |grep pulse ## verify no pulseaudio
qjackctl ## start session
giada
## kill qjackctl
ps ax |grep jack
kill [pid of jackd]
pulseaudio --start

@monocasual
Copy link
Collaborator

monocasual commented Jun 2, 2017

Actually that was 100% Giada's fault. Fixed in 7d0908c. The special buffer vChanInput was not resized correctly on beats change. Can you confirm this?

@jwhendy
Copy link
Contributor Author

jwhendy commented Jun 3, 2017

Yaaaayyyy! So rad and now I can get onto making sick beats with my kids :) Thanks so much for persisting and the quick fix. I dug around in mixer.cpp myself, but my C++-fu was not jedi enough. You rock!

@jwhendy jwhendy closed this as completed Jun 3, 2017
@jwhendy
Copy link
Contributor Author

jwhendy commented Jun 10, 2017

FYI, I am sometimes getting crashes the first time I attempt this. The second time it is opening back up with my 8/1 setting and adjusted bpm, and works fine. I have only maybe fiddled 3-4 times with it and keep forgetting about this phenomenon.

I'll try to run with gdb next time it occurs and see what's up.

@f3flight
Copy link

f3flight commented Jul 15, 2017

please build a new release for windows with this fix, wihtout it windows build (0.14.0) is unusable - crashes every time after changing from 4/1 to anything else.

I tried myself but got stuck since there is no doc on how to build under Windows.

@monocasual
Copy link
Collaborator

monocasual commented Jul 16, 2017

@f3flight don't worry, 0.14.1 is coming out very soon!

@monocasual monocasual removed their assignment Nov 23, 2020
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

2 participants