bugGNU Octave - Bugs: bug #43994, New audio can crash octave when...

 
 

bug #43994: New audio can crash octave when rerun.

Submitter:  Doug Stewart <dastew>
Submitted:  Tue 13 Jan 2015 03:36:11 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Doug Stewart Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 14 Jan 2015 07:22:25 PM UTC, comment #8: 

markuman was so kind to test this code with matlab R2014b:

Fs=44100;
t=10;
x=0:1/Fs:t;
y(:,2)=sin(2*pi*220*x);
y(:,1)=sin(2*pi*440*x);
q=audioplayer(y,Fs,16);
play(q);
pause(2);
q=audioplayer(y,Fs,16);


The sound stopped after 2 seconds. There was no warning and no error message.

Without second 'q=audioplayer...' it plays 10 seconds, as expected.

So I think the current approach is the right way, but the warning is not neccessary to be MATLAB compatible.

Stefan Mahr <dac922>
Tue 13 Jan 2015 01:27:50 PM UTC, comment #7: 

Seems to me cset 9bd2f0a07c95 is causing this issue. The audio data was copied before, so it remains valid within the static callback function.

However, I don't know the MATLAB compatible way. Should it stop playing old audio, when the old object is deleted or should it continue play the old audio?

Stefan Mahr <dac922>
Tue 13 Jan 2015 12:53:54 PM UTC, comment #6: 

this has been fixed. no crash now.

Doug Stewart <dastew>
Tue 13 Jan 2015 12:35:40 PM UTC, comment #5: 

sorry I actually used sleep(1)

Doug Stewart <dastew>
Tue 13 Jan 2015 11:57:28 AM UTC, comment #4: 

I think Stefan is right. @Doug: can you please test cset http://hg.savannah.gnu.org/hgweb/octave/rev/62ca016dbb2a

Your second testcase uses "delay". Is this an OCtave function or should this be "sleep"?

Andreas Weber <andy1978>
Group Member
Tue 13 Jan 2015 10:52:27 AM UTC, comment #3: 

My guess: The second q=audioplayer(y,Fs,16); creates a new object and destroys the old 'q'. If the first 'q' is still playing, the old play_callback function wants to access the pointers from the old 'q' object. Since the object was released, the pointers are not valid anymore.

Stefan Mahr <dac922>
Tue 13 Jan 2015 10:39:04 AM UTC, comment #2: 

I can confirm this on c36c22808d11.


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fbce7fff700 (LWP 9225)]
0x00007fbd26b404ca in dim_vector::dim_vector (this=0x7fbce7ffeb68, dv=...)
    at ../../octave-src/liboctave/array/dim-vector.h:216
216          { OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); }


Looks like the known multithreading problem.


(gdb) bt
#0  0x00007fbd26b404ca in dim_vector::dim_vector (this=0x7fbce7ffeb68, dv=...)
    at ../../octave-src/liboctave/array/dim-vector.h:216
#1  0x00007fbd26b4d0af in Array<double>::Array (this=0x7fbce7ffeb60, a=...)
    at ../../octave-src/liboctave/array/Array.h:213
#2  0x00007fbd26b4ced7 in MArray<double>::MArray (this=0x7fbce7ffeb60, a=...)
    at ../../octave-src/liboctave/array/MArray.h:58
#3  0x00007fbd249b3e43 in RowVector::RowVector (this=0x7fbce7ffeb60, a=...)
    at ../../octave-src/liboctave/array/dRowVector.h:46
#4  0x00007fbcf3de3ed2 in audioplayer::get_left (this=0x7fbcf8251a00)
    at ../../octave-src/libinterp/dldfcn/audiodevinfo.cc:947
#5  0x00007fbcf3de2cf0 in portaudio_play_callback (output=0x7fbcf8d84c10,
    frames=8192, data=0x7fbcf8251a00)
    at ../../octave-src/libinterp/dldfcn/audiodevinfo.cc:653
#6  0x00007fbcf3ba16e4 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libportaudio.so.2
#7  0x00007fbcf3ba307d in ?? ()
   from /usr/lib/x86_64-linux-gnu/libportaudio.so.2
#8  0x00007fbcf3bab6ce in ?? ()
   from /usr/lib/x86_64-linux-gnu/libportaudio.so.2
#9  0x00007fbd236040a4 in start_thread (arg=0x7fbce7fff700)
    at pthread_create.c:309
#10 0x00007fbd23338ccd in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111


Andreas Weber <andy1978>
Group Member
Tue 13 Jan 2015 10:30:15 AM UTC, comment #1: 

This crashes for me.

+verbatum+
Fs=44100;
t=10;
x=0:1/Fs:t;
y(:,2)=sin(2*pi*220*x);
y(:,1)=sin(2*pi*440*x);
q=audioplayer(y,Fs,16);
play(q);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
q=audioplayer(y,Fs,16);
-verbatum-

and also this:
+verbatum+
Fs=44100;
t=10;
x=0:1/Fs:t;
y(:,2)=sin(2*pi*220*x);
y(:,1)=sin(2*pi*440*x);
q=audioplayer(y,Fs,16);
play(q);
delay(1)
play(q)
-verbatum-

Doug Stewart <dastew>
Tue 13 Jan 2015 03:36:11 AM UTC, original submission:  

When using the following prog:


clear
Fs=44100;
t=10;
x=0:1/Fs:t;
y(:,2)=sin(2*pi*220*x);
y(:,1)=sin(2*pi*440*x);
q=audioplayer(y,Fs,16);
play(q)


If you hit the blue run icon to start the sound, and then press it again and again, first the sound goes bad and the octave crashes with signal 11 and once with signal 6.

The time with signal 6  there was an error message about a callback problem. I did not get it copied down before octave crashed , and then the message was lost forever.

In summery if you rerun the software before it has finished the first run, it might crash, some times it doesn't.

Doug Stewart <dastew>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by dac922 (Posted a comment)
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by dastew (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-30 mtmiller StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2015-01-13 andy1978 StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code