Menu

#1130 SEGFAULT by changing number of JACK channels more that at start

v0.45
open
nobody
jack (3)
5
2014-01-30
2014-01-28
Anonymous
No

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.

Discussion

  • Viacheslav Lotsmanov

    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.

     
  • Viacheslav Lotsmanov

    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.

     
  • Miller Puckette

    Miller Puckette - 2014-01-29

    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 :)

     
    • IOhannes m zmölnig

      make sure to start jack before Pd (autostarting jack from within Pd is still somewhat buggy when it comes to shutdown)

       
  • IOhannes m zmölnig

    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

    • Pd 0.45-4 (as packaged in Debian)
    • jackdmp 1.9.10 (as packaged in Debian)
    • Linux 3.11-2-686-pae #1 SMP Debian 3.11.10-1 (2013-12-04) i686 GNU/Linux
     
    • Viacheslav Lotsmanov

      Do you using pd-extended? I'm talking about pd vanilla (this repo: https://sourceforge.net/p/pure-data/pure-data/)

       
      • IOhannes m zmölnig

        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. 786de7b0e9

         

        Last edit: IOhannes m zmölnig 2014-01-30
        • Viacheslav Lotsmanov

          What info about my system you need?

           
  • IOhannes m zmölnig

    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)

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB