If I started PD with 1 channel like this:
./pd -jack -channels 1
And try to change number of JACK channels more that 1 — I'll have crash by segfault.
Or can start pd with 2 channels (by default) and change to 3 channels in media and have segfault again. But if change to less than at start it works fine, without any crashes. It looks like in PD allocated jack port array at start and when we changing number of channels it doesn't reallocate memory for array.
Anonymous
I found it! If start pd with 2 ports and set to 1 port and back to 2, — I have segfault too.
In src/s_audio_jack.c in function "callbackprocess" and "pollprocess" we have getting jack ports, but in "src/s_audio.c" changing "sys_outchannels" or "sys_inchannels" before jack ports creating and "callbackprocess" or "pollprocess" still processing and trying to write/read to/from zero ("jack_port_get_buffer" returns zero if port is not exist or handler if exist). If we put checking to the cycles like:
if (in[chan] == 0) break;
then we have no segfaults but errors messages in pd-log about wrong jack port.
As I see this bug in other places too, I put this fixes, but if I started by 2 and set to 9 (for example) and to 1 and to more than 1, then segfault.
I put in the in and out != checks (thanks) but anyhow anytime I change
the number of channels in Pd after having started jack it hangs Pd and
sometimes hangs jack too. I'l stick this on my long list of things to
try to figure out and fix :)
make sure to start jack before Pd (autostarting jack from within Pd is still somewhat buggy when it comes to shutdown)
i cannot reproduce this problem when i start Pd with an already running jack.
also i cannot reproducde the problem with a jack automatically started by Pd.
i'm using
Do you using pd-extended? I'm talking about pd vanilla (this repo: https://sourceforge.net/p/pure-data/pure-data/)
no, i'm using pd-vanilla, Pd-0.45.4 as packaged in Debian (the official Debian packages are Pd-vanilla)
it would be great if you could give details about your system setup (like i did).
and since you are using the git version of Pd, please specify the exact revision, e.g.
786de7b0e9Last edit: IOhannes m zmölnig 2014-01-30
What info about my system you need?
finally i've been able to reproduce the problem.
the important thing is, that you have to enable callbacks (which for whatever reasons is not enabled by default on my machine)