Request help debugging octave-video in mxe-octave

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Request help debugging octave-video in mxe-octave

Andreas Weber-4
Dear maintainers,

I need some help debugging octave-video with ffmpeg in mxe-octave.
Sometimes I get a strange segmentation fault in the AVHandler destructor.

What I've done so far:
Crosscompile mxe-octave on Debian Jessie with
$ ./configure --disable-strip-dist-files --enable-devel-tools
--enable-binary-packages
$ make gdb ffmpeg zip-dist

In Windows7, extract zip, and grab code from
http://sourceforge.net/p/octave/video/ci/default/tree/
run octave in CLI mode, getpid, attach gdb.

Back in Octave:
 >> cd octave/video/src
 >> test avifile

This sometimes works (PASS 1/1) and sometimes fails at different places:

----------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2648.0x7f4]
0x7795e3c6 in ntdll!RtlInitUnicodeString () from
C:\Windows\SysWOW64\ntdll.dll
(gdb)
Continuing.

--------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3212.0xe9c]
0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
(gdb) bt
#0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
#1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
#2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
#3  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
#4  0x17aa0000 in ?? ()
#5  0x1c0159fe in avpriv_mpa_decode_header ()
    from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
#6  0x1c3bcce9 in avcodec-56!av_dct_end ()
    from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
#7  0x1c3ce86e in avcodec_close ()
    from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
#8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
     __in_chrg=<optimized out>) at AVHandler.cc:83
#9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,

---------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3184.0xe48]
0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
(gdb) bt
#0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
#1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
    from C:\Windows\SysWOW64\ntdll.dll
#2  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
#3  0x17a70000 in ?? ()
#4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
Array.h:89
#5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
Array.h:223
#6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
MArray.h:63
#7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
dNDArray.h:35
#8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/octave
-value/ov-base-mat.h:68
#9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
     at
/home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/octave
-value/ov-re-mat.h:97

Any ideas what I could try?
Thank you, Andy

Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

PrasannaKumar Muralidharan
Hi Andreas,

Stack trace shows msvcrt!free which probably means the memory was
corrupted long before 'free' was called. Can you add a print statement
before call to 'AVFree' or any destructor / delete in the video
package code and see till which point the code reaches. That may help
solving the issue.

I don't have a windows build to test your issue.

Thanks and regards,
PrasannaKumar

Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

Andreas Weber-4
Hi PrasannaKumar,

Am 05.01.2016 um 18:09 schrieb PrasannaKumar Muralidharan:
> Stack trace shows msvcrt!free which probably means the memory was
> corrupted long before 'free' was called. Can you add a print statement
> before call to 'AVFree' or any destructor / delete in the video
> package code and see till which point the code reaches. That may help
> solving the issue.

In the second backtrace it's AVHandler.cc:83

In the meanwhile I was able to compile video with the latest ffmpeg
binaries from https://ffmpeg.zeranoe.com/builds/.
This build doesn't show the problem.

-- Andy

Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

John Swensen-3
In reply to this post by Andreas Weber-4

> On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]> wrote:
>
> Dear maintainers,
>
> I need some help debugging octave-video with ffmpeg in mxe-octave.
> Sometimes I get a strange segmentation fault in the AVHandler destructor.
>
> What I've done so far:
> Crosscompile mxe-octave on Debian Jessie with
> $ ./configure --disable-strip-dist-files --enable-devel-tools --enable-binary-packages
> $ make gdb ffmpeg zip-dist
>
> In Windows7, extract zip, and grab code from http://sourceforge.net/p/octave/video/ci/default/tree/
> run octave in CLI mode, getpid, attach gdb.
>
> Back in Octave:
> >> cd octave/video/src
> >> test avifile
>
> This sometimes works (PASS 1/1) and sometimes fails at different places:
>
> ----------------------------------------------------
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 2648.0x7f4]
> 0x7795e3c6 in ntdll!RtlInitUnicodeString () from C:\Windows\SysWOW64\ntdll.dll
> (gdb)
> Continuing.
>
> --------------------------------------------------
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 3212.0xe9c]
> 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> (gdb) bt
> #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> #3  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> #4  0x17aa0000 in ?? ()
> #5  0x1c0159fe in avpriv_mpa_decode_header ()
>   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> #6  0x1c3bcce9 in avcodec-56!av_dct_end ()
>   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> #7  0x1c3ce86e in avcodec_close ()
>   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
>    __in_chrg=<optimized out>) at AVHandler.cc:83
> #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
>
> ---------------------------------------------------------
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 3184.0xe48]
> 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> (gdb) bt
> #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
>   from C:\Windows\SysWOW64\ntdll.dll
> #2  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> #3  0x17a70000 in ?? ()
> #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
> Array.h:89
> #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
> Array.h:223
> #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
> MArray.h:63
> #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/array/
> dNDArray.h:35
> #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/octave
> -value/ov-base-mat.h:68
> #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
>    at /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/octave
> -value/ov-re-mat.h:97
>
> Any ideas what I could try?
> Thank you, Andy
>

My initial thought would be that the “clear m” in the test script is forcing the destructor to be called and it is possible that stuff is still going on in the encoding process (ffmpeg is sometimes multithreaded depending on the codec, and there could still be file IO going on).

As a first test, I would put a big delay (say 5-10 seconds) between the ‘endfor' and the ‘clear m'  in the avifile test. If it is just a matter of trying to delete the ffmpeg codec and other objects before they are ready to be deleted, that could cause a segfault. I know there is a chunk of code just previous to the segfault location that *should be* cleaning things up before closing everything, but maybe it isn’t cleaning up correctly?

John S.



Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

John Donoghue-3
In reply to this post by Andreas Weber-4
>
> Message: 3
> Date: Tue, 5 Jan 2016 10:21:55 -0800
> From: John Swensen <[hidden email]>
> To: Andreas Weber <[hidden email]>
> Cc: octave-maintainers <[hidden email]>
> Subject: Re: Request help debugging octave-video in mxe-octave
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=utf-8
>
>
> > On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]> wrote:
> >
> > Dear maintainers,
> >
> > I need some help debugging octave-video with ffmpeg in mxe-octave.
> > Sometimes I get a strange segmentation fault in the AVHandler
destructor.

> >
> > What I've done so far:
> > Crosscompile mxe-octave on Debian Jessie with $ ./configure
> > --disable-strip-dist-files --enable-devel-tools
> > --enable-binary-packages $ make gdb ffmpeg zip-dist
> >
> > In Windows7, extract zip, and grab code from
> > http://sourceforge.net/p/octave/video/ci/default/tree/
> > run octave in CLI mode, getpid, attach gdb.
> >
> > Back in Octave:
> > >> cd octave/video/src
> > >> test avifile
> >
> > This sometimes works (PASS 1/1) and sometimes fails at different places:
> >
> > ----------------------------------------------------
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 2648.0x7f4]
> > 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
> > C:\Windows\SysWOW64\ntdll.dll
> > (gdb)
> > Continuing.
> >
> > --------------------------------------------------
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 3212.0xe9c]
> > 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > (gdb) bt
> > #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > #3  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> > #4  0x17aa0000 in ?? ()
> > #5  0x1c0159fe in avpriv_mpa_decode_header ()
> >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > #6  0x1c3bcce9 in avcodec-56!av_dct_end ()
> >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > #7  0x1c3ce86e in avcodec_close ()
> >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
> >    __in_chrg=<optimized out>) at AVHandler.cc:83
> > #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
> >
> > ---------------------------------------------------------
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 3184.0xe48]
> > 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > (gdb) bt
> > #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
> >   from C:\Windows\SysWOW64\ntdll.dll
> > #2  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> > #3  0x17a70000 in ?? ()
> > #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/arr
> > ay/
> > Array.h:89
> > #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/arr
> > ay/
> > Array.h:223
> > #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/arr
> > ay/
> > MArray.h:63
> > #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/arr
> > ay/
> > dNDArray.h:35
> > #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/oct
> > ave
> > -value/ov-base-mat.h:68
> > #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> >    at
> > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/oct
> > ave
> > -value/ov-re-mat.h:97
> >
> > Any ideas what I could try?
> > Thank you, Andy
> >
>
> My initial thought would be that the ?clear m? in the test script is
forcing the
> destructor to be called and it is possible that stuff is still going on in
the encoding
> process (ffmpeg is sometimes multithreaded depending on the codec, and
there
> could still be file IO going on).
>
> As a first test, I would put a big delay (say 5-10 seconds) between the
?endfor'
> and the ?clear m'  in the avifile test. If it is just a matter of trying
to delete the
> ffmpeg codec and other objects before they are ready to be deleted, that
could
> cause a segfault. I know there is a chunk of code just previous to the
segfault
> location that *should be* cleaning things up before closing everything,
but
> maybe it isn?t cleaning up correctly?
>
> John S.
>


Ok - I can see it on my build as well - it doesn't happen all the time

I used to see it crash on calling avifile before 1.2.1, but don't seem to
see it there anymore, but do see it when running the video test script


Reply | Threaded
Open this post in threaded view
|

RE: Request help debugging octave-video in mxe-octave

John Donoghue-3


> -----Original Message-----
> From: JohnD [mailto:[hidden email]]
> Sent: Thursday, January 07, 2016 8:02 AM
> To: [hidden email]
> Cc: 'John Swensen'; 'Andreas Weber'
> Subject: Re: Request help debugging octave-video in mxe-octave
>
> >
> > Message: 3
> > Date: Tue, 5 Jan 2016 10:21:55 -0800
> > From: John Swensen <[hidden email]>
> > To: Andreas Weber <[hidden email]>
> > Cc: octave-maintainers <[hidden email]>
> > Subject: Re: Request help debugging octave-video in mxe-octave
> > Message-ID: <[hidden email]>
> > Content-Type: text/plain; charset=utf-8
> >
> >
> > > On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]>
wrote:

> > >
> > > Dear maintainers,
> > >
> > > I need some help debugging octave-video with ffmpeg in mxe-octave.
> > > Sometimes I get a strange segmentation fault in the AVHandler
> destructor.
> > >
> > > What I've done so far:
> > > Crosscompile mxe-octave on Debian Jessie with $ ./configure
> > > --disable-strip-dist-files --enable-devel-tools
> > > --enable-binary-packages $ make gdb ffmpeg zip-dist
> > >
> > > In Windows7, extract zip, and grab code from
> > > http://sourceforge.net/p/octave/video/ci/default/tree/
> > > run octave in CLI mode, getpid, attach gdb.
> > >
> > > Back in Octave:
> > > >> cd octave/video/src
> > > >> test avifile
> > >
> > > This sometimes works (PASS 1/1) and sometimes fails at different
places:

> > >
> > > ----------------------------------------------------
> > > Program received signal SIGSEGV, Segmentation fault.
> > > [Switching to Thread 2648.0x7f4]
> > > 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
> > > C:\Windows\SysWOW64\ntdll.dll
> > > (gdb)
> > > Continuing.
> > >
> > > --------------------------------------------------
> > > Program received signal SIGSEGV, Segmentation fault.
> > > [Switching to Thread 3212.0xe9c]
> > > 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > (gdb) bt
> > > #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > #3  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> > > #4  0x17aa0000 in ?? ()
> > > #5  0x1c0159fe in avpriv_mpa_decode_header ()
> > >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > #6  0x1c3bcce9 in avcodec-56!av_dct_end ()
> > >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > #7  0x1c3ce86e in avcodec_close ()
> > >   from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
> > >    __in_chrg=<optimized out>) at AVHandler.cc:83
> > > #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
> > >
> > > ---------------------------------------------------------
> > > Program received signal SIGSEGV, Segmentation fault.
> > > [Switching to Thread 3184.0xe48]
> > > 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > (gdb) bt
> > > #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
> > >   from C:\Windows\SysWOW64\ntdll.dll
> > > #2  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
> > > #3  0x17a70000 in ?? ()
> > > #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized
out>)

> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
> > > rr
> > > ay/
> > > Array.h:89
> > > #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
> > > rr
> > > ay/
> > > Array.h:223
> > > #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
> > > rr
> > > ay/
> > > MArray.h:63
> > > #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
> > > rr
> > > ay/
> > > dNDArray.h:35
> > > #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/o
> > > ct
> > > ave
> > > -value/ov-base-mat.h:68
> > > #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> > >    at
> > > /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/o
> > > ct
> > > ave
> > > -value/ov-re-mat.h:97
> > >
> > > Any ideas what I could try?
> > > Thank you, Andy
> > >
> >
> > My initial thought would be that the ?clear m? in the test script is
> forcing the
> > destructor to be called and it is possible that stuff is still going
> > on in
> the encoding
> > process (ffmpeg is sometimes multithreaded depending on the codec, and
> there
> > could still be file IO going on).
> >
> > As a first test, I would put a big delay (say 5-10 seconds) between
> > the
> ?endfor'
> > and the ?clear m'  in the avifile test. If it is just a matter of
> > trying
> to delete the
> > ffmpeg codec and other objects before they are ready to be deleted,
> > that
> could
> > cause a segfault. I know there is a chunk of code just previous to the
> segfault
> > location that *should be* cleaning things up before closing
> > everything,
> but
> > maybe it isn?t cleaning up correctly?
> >
> > John S.
> >
>
>
> Ok - I can see it on my build as well - it doesn't happen all the time
>
> I used to see it crash on calling avifile before 1.2.1, but don't seem to
see it
> there anymore, but do see it when running the video test script

Not sure if this solves it, but ...

Looking at the video package source code:
AviFile has a copy constructor that is private, so normally wont be used.
However I beleive the default AviFile constructor DOES use it  with
*this=AviFile("default.avi")

The copy constructor blindly sets 'av' to point to the same value as what
the other constructor, so when it frees all the octave_base_value objects,
it has multiple base value objects trying to free the same 'av' pointer





Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

John Swensen-3

> On Jan 7, 2016, at 12:01 PM, JohnD <[hidden email]> wrote:
>
>
>
>> -----Original Message-----
>> From: JohnD [mailto:[hidden email]]
>> Sent: Thursday, January 07, 2016 8:02 AM
>> To: [hidden email]
>> Cc: 'John Swensen'; 'Andreas Weber'
>> Subject: Re: Request help debugging octave-video in mxe-octave
>>
>>>
>>> Message: 3
>>> Date: Tue, 5 Jan 2016 10:21:55 -0800
>>> From: John Swensen <[hidden email]>
>>> To: Andreas Weber <[hidden email]>
>>> Cc: octave-maintainers <[hidden email]>
>>> Subject: Re: Request help debugging octave-video in mxe-octave
>>> Message-ID: <[hidden email]>
>>> Content-Type: text/plain; charset=utf-8
>>>
>>>
>>>> On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]>
> wrote:
>>>>
>>>> Dear maintainers,
>>>>
>>>> I need some help debugging octave-video with ffmpeg in mxe-octave.
>>>> Sometimes I get a strange segmentation fault in the AVHandler
>> destructor.
>>>>
>>>> What I've done so far:
>>>> Crosscompile mxe-octave on Debian Jessie with $ ./configure
>>>> --disable-strip-dist-files --enable-devel-tools
>>>> --enable-binary-packages $ make gdb ffmpeg zip-dist
>>>>
>>>> In Windows7, extract zip, and grab code from
>>>> http://sourceforge.net/p/octave/video/ci/default/tree/
>>>> run octave in CLI mode, getpid, attach gdb.
>>>>
>>>> Back in Octave:
>>>>>> cd octave/video/src
>>>>>> test avifile
>>>>
>>>> This sometimes works (PASS 1/1) and sometimes fails at different
> places:
>>>>
>>>> ----------------------------------------------------
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 2648.0x7f4]
>>>> 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
>>>> C:\Windows\SysWOW64\ntdll.dll
>>>> (gdb)
>>>> Continuing.
>>>>
>>>> --------------------------------------------------
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 3212.0xe9c]
>>>> 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> (gdb) bt
>>>> #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> #3  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
>>>> #4  0x17aa0000 in ?? ()
>>>> #5  0x1c0159fe in avpriv_mpa_decode_header ()
>>>>  from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
>>>> #6  0x1c3bcce9 in avcodec-56!av_dct_end ()
>>>>  from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
>>>> #7  0x1c3ce86e in avcodec_close ()
>>>>  from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
>>>> #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
>>>>   __in_chrg=<optimized out>) at AVHandler.cc:83
>>>> #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
>>>>
>>>> ---------------------------------------------------------
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 3184.0xe48]
>>>> 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> (gdb) bt
>>>> #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()
>>>>  from C:\Windows\SysWOW64\ntdll.dll
>>>> #2  0x76b698cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
>>>> #3  0x17a70000 in ?? ()
>>>> #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized
> out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
>>>> rr
>>>> ay/
>>>> Array.h:89
>>>> #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
>>>> rr
>>>> ay/
>>>> Array.h:223
>>>> #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
>>>> rr
>>>> ay/
>>>> MArray.h:63
>>>> #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/a
>>>> rr
>>>> ay/
>>>> dNDArray.h:35
>>>> #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/o
>>>> ct
>>>> ave
>>>> -value/ov-base-mat.h:68
>>>> #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
>>>>   at
>>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/o
>>>> ct
>>>> ave
>>>> -value/ov-re-mat.h:97
>>>>
>>>> Any ideas what I could try?
>>>> Thank you, Andy
>>>>
>>>
>>> My initial thought would be that the ?clear m? in the test script is
>> forcing the
>>> destructor to be called and it is possible that stuff is still going
>>> on in
>> the encoding
>>> process (ffmpeg is sometimes multithreaded depending on the codec, and
>> there
>>> could still be file IO going on).
>>>
>>> As a first test, I would put a big delay (say 5-10 seconds) between
>>> the
>> ?endfor'
>>> and the ?clear m'  in the avifile test. If it is just a matter of
>>> trying
>> to delete the
>>> ffmpeg codec and other objects before they are ready to be deleted,
>>> that
>> could
>>> cause a segfault. I know there is a chunk of code just previous to the
>> segfault
>>> location that *should be* cleaning things up before closing
>>> everything,
>> but
>>> maybe it isn?t cleaning up correctly?
>>>
>>> John S.
>>>
>>
>>
>> Ok - I can see it on my build as well - it doesn't happen all the time
>>
>> I used to see it crash on calling avifile before 1.2.1, but don't seem to
> see it
>> there anymore, but do see it when running the video test script
>
> Not sure if this solves it, but ...
>
> Looking at the video package source code:
> AviFile has a copy constructor that is private, so normally wont be used.
> However I beleive the default AviFile constructor DOES use it  with
> *this=AviFile("default.avi")
>
> The copy constructor blindly sets 'av' to point to the same value as what
> the other constructor, so when it frees all the octave_base_value objects,
> it has multiple base value objects trying to free the same 'av’ pointer
>

That may be a problem, but I don’t think the default constructor is ever being called during the avifile test and I don’t ever see the warning "avifile: copy constructor shouldn't be called” that should occur if the copy constructor was actually being called.
Reply | Threaded
Open this post in threaded view
|

RE: Request help debugging octave-video in mxe-octave

John Donoghue-3


> -----Original Message-----
> From: John Swensen [mailto:[hidden email]]
> Sent: Thursday, January 07, 2016 3:19 PM
> To: JohnD
> Cc: [hidden email]; Andreas Weber
> Subject: Re: Request help debugging octave-video in mxe-octave
>
>
> > On Jan 7, 2016, at 12:01 PM, JohnD <[hidden email]>
> wrote:
> >
> >
> >
> >> -----Original Message-----
> >> From: JohnD [mailto:[hidden email]]
> >> Sent: Thursday, January 07, 2016 8:02 AM
> >> To: [hidden email]
> >> Cc: 'John Swensen'; 'Andreas Weber'
> >> Subject: Re: Request help debugging octave-video in mxe-octave
> >>
> >>>
> >>> Message: 3
> >>> Date: Tue, 5 Jan 2016 10:21:55 -0800
> >>> From: John Swensen <[hidden email]>
> >>> To: Andreas Weber <[hidden email]>
> >>> Cc: octave-maintainers <[hidden email]>
> >>> Subject: Re: Request help debugging octave-video in mxe-octave
> >>> Message-ID: <[hidden email]>
> >>> Content-Type: text/plain; charset=utf-8
> >>>
> >>>
> >>>> On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]>
> > wrote:
> >>>>
> >>>> Dear maintainers,
> >>>>
> >>>> I need some help debugging octave-video with ffmpeg in mxe-octave.
> >>>> Sometimes I get a strange segmentation fault in the AVHandler
> >> destructor.
> >>>>
> >>>> What I've done so far:
> >>>> Crosscompile mxe-octave on Debian Jessie with $ ./configure
> >>>> --disable-strip-dist-files --enable-devel-tools
> >>>> --enable-binary-packages $ make gdb ffmpeg zip-dist
> >>>>
> >>>> In Windows7, extract zip, and grab code from
> >>>> http://sourceforge.net/p/octave/video/ci/default/tree/
> >>>> run octave in CLI mode, getpid, attach gdb.
> >>>>
> >>>> Back in Octave:
> >>>>>> cd octave/video/src
> >>>>>> test avifile
> >>>>
> >>>> This sometimes works (PASS 1/1) and sometimes fails at different
> > places:
> >>>>
> >>>> ----------------------------------------------------
> >>>> Program received signal SIGSEGV, Segmentation fault.
> >>>> [Switching to Thread 2648.0x7f4]
> >>>> 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> (gdb)
> >>>> Continuing.
> >>>>
> >>>> --------------------------------------------------
> >>>> Program received signal SIGSEGV, Segmentation fault.
> >>>> [Switching to Thread 3212.0xe9c]
> >>>> 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> (gdb) bt
> >>>> #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> #3  0x76b698cd in msvcrt!free () from
> >>>> C:\Windows\syswow64\msvcrt.dll
> >>>> #4  0x17aa0000 in ?? ()
> >>>> #5  0x1c0159fe in avpriv_mpa_decode_header ()  from
> >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> >>>> #6  0x1c3bcce9 in avcodec-56!av_dct_end ()  from
> >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> >>>> #7  0x1c3ce86e in avcodec_close ()
> >>>>  from C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> >>>> #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
> >>>>   __in_chrg=<optimized out>) at AVHandler.cc:83
> >>>> #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
> >>>>
> >>>> ---------------------------------------------------------
> >>>> Program received signal SIGSEGV, Segmentation fault.
> >>>> [Switching to Thread 3184.0xe48]
> >>>> 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> (gdb) bt
> >>>> #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> >>>> C:\Windows\SysWOW64\ntdll.dll
> >>>> #2  0x76b698cd in msvcrt!free () from
> >>>> C:\Windows\syswow64\msvcrt.dll
> >>>> #3  0x17a70000 in ?? ()
> >>>> #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70, __in_chrg=<optimized
> > out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/
> >>>> a
> >>>> rr
> >>>> ay/
> >>>> Array.h:89
> >>>> #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/
> >>>> a
> >>>> rr
> >>>> ay/
> >>>> Array.h:223
> >>>> #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/
> >>>> a
> >>>> rr
> >>>> ay/
> >>>> MArray.h:63
> >>>> #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/
> >>>> a
> >>>> rr
> >>>> ay/
> >>>> dNDArray.h:35
> >>>> #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/
> >>>> o
> >>>> ct
> >>>> ave
> >>>> -value/ov-base-mat.h:68
> >>>> #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> >>>>   at
> >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinterp/
> >>>> o
> >>>> ct
> >>>> ave
> >>>> -value/ov-re-mat.h:97
> >>>>
> >>>> Any ideas what I could try?
> >>>> Thank you, Andy
> >>>>
> >>>
> >>> My initial thought would be that the ?clear m? in the test script is
> >> forcing the
> >>> destructor to be called and it is possible that stuff is still going
> >>> on in
> >> the encoding
> >>> process (ffmpeg is sometimes multithreaded depending on the codec,
> >>> and
> >> there
> >>> could still be file IO going on).
> >>>
> >>> As a first test, I would put a big delay (say 5-10 seconds) between
> >>> the
> >> ?endfor'
> >>> and the ?clear m'  in the avifile test. If it is just a matter of
> >>> trying
> >> to delete the
> >>> ffmpeg codec and other objects before they are ready to be deleted,
> >>> that
> >> could
> >>> cause a segfault. I know there is a chunk of code just previous to
> >>> the
> >> segfault
> >>> location that *should be* cleaning things up before closing
> >>> everything,
> >> but
> >>> maybe it isn?t cleaning up correctly?
> >>>
> >>> John S.
> >>>
> >>
> >>
> >> Ok - I can see it on my build as well - it doesn't happen all the
> >> time
> >>
> >> I used to see it crash on calling avifile before 1.2.1, but don't
> >> seem to
> > see it
> >> there anymore, but do see it when running the video test script
> >
> > Not sure if this solves it, but ...
> >
> > Looking at the video package source code:
> > AviFile has a copy constructor that is private, so normally wont be used.
> > However I beleive the default AviFile constructor DOES use it  with
> > *this=AviFile("default.avi")
> >
> > The copy constructor blindly sets 'av' to point to the same value as
> > what the other constructor, so when it frees all the octave_base_value
> > objects, it has multiple base value objects trying to free the same
> > 'av’ pointer
> >
>
> That may be a problem, but I don’t think the default constructor is ever being
> called during the avifile test and I don’t ever see the warning "avifile: copy
> constructor shouldn't be called” that should occur if the copy constructor was
> actually being called.

Isnt the '=' operator going to do a similar thing - its going to blindly copy the av pointer between objects


Reply | Threaded
Open this post in threaded view
|

RE: Request help debugging octave-video in mxe-octave

John Donoghue-3


> -----Original Message-----
> From: JohnD [mailto:[hidden email]]
> Sent: Thursday, January 07, 2016 4:27 PM
> To: 'John Swensen'
> Cc: [hidden email]; 'Andreas Weber'
> Subject: RE: Request help debugging octave-video in mxe-octave
>
>
>
> > -----Original Message-----
> > From: John Swensen [mailto:[hidden email]]
> > Sent: Thursday, January 07, 2016 3:19 PM
> > To: JohnD
> > Cc: [hidden email]; Andreas Weber
> > Subject: Re: Request help debugging octave-video in mxe-octave
> >
> >
> > > On Jan 7, 2016, at 12:01 PM, JohnD <[hidden email]>
> > wrote:
> > >
> > >
> > >
> > >> -----Original Message-----
> > >> From: JohnD [mailto:[hidden email]]
> > >> Sent: Thursday, January 07, 2016 8:02 AM
> > >> To: [hidden email]
> > >> Cc: 'John Swensen'; 'Andreas Weber'
> > >> Subject: Re: Request help debugging octave-video in mxe-octave
> > >>
> > >>>
> > >>> Message: 3
> > >>> Date: Tue, 5 Jan 2016 10:21:55 -0800
> > >>> From: John Swensen <[hidden email]>
> > >>> To: Andreas Weber <[hidden email]>
> > >>> Cc: octave-maintainers <[hidden email]>
> > >>> Subject: Re: Request help debugging octave-video in mxe-octave
> > >>> Message-ID: <[hidden email]>
> > >>> Content-Type: text/plain; charset=utf-8
> > >>>
> > >>>
> > >>>> On Jan 1, 2016, at 10:58 AM, Andreas Weber <[hidden email]>
> > > wrote:
> > >>>>
> > >>>> Dear maintainers,
> > >>>>
> > >>>> I need some help debugging octave-video with ffmpeg in mxe-octave.
> > >>>> Sometimes I get a strange segmentation fault in the AVHandler
> > >> destructor.
> > >>>>
> > >>>> What I've done so far:
> > >>>> Crosscompile mxe-octave on Debian Jessie with $ ./configure
> > >>>> --disable-strip-dist-files --enable-devel-tools
> > >>>> --enable-binary-packages $ make gdb ffmpeg zip-dist
> > >>>>
> > >>>> In Windows7, extract zip, and grab code from
> > >>>> http://sourceforge.net/p/octave/video/ci/default/tree/
> > >>>> run octave in CLI mode, getpid, attach gdb.
> > >>>>
> > >>>> Back in Octave:
> > >>>>>> cd octave/video/src
> > >>>>>> test avifile
> > >>>>
> > >>>> This sometimes works (PASS 1/1) and sometimes fails at different
> > > places:
> > >>>>
> > >>>> ----------------------------------------------------
> > >>>> Program received signal SIGSEGV, Segmentation fault.
> > >>>> [Switching to Thread 2648.0x7f4]
> > >>>> 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> (gdb)
> > >>>> Continuing.
> > >>>>
> > >>>> --------------------------------------------------
> > >>>> Program received signal SIGSEGV, Segmentation fault.
> > >>>> [Switching to Thread 3212.0xe9c]
> > >>>> 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> (gdb) bt
> > >>>> #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> #3  0x76b698cd in msvcrt!free () from
> > >>>> C:\Windows\syswow64\msvcrt.dll
> > >>>> #4  0x17aa0000 in ?? ()
> > >>>> #5  0x1c0159fe in avpriv_mpa_decode_header ()  from
> > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > >>>> #6  0x1c3bcce9 in avcodec-56!av_dct_end ()  from
> > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > >>>> #7  0x1c3ce86e in avcodec_close ()  from
> > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > >>>> #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
> > >>>>   __in_chrg=<optimized out>) at AVHandler.cc:83
> > >>>> #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
> > >>>>
> > >>>> ---------------------------------------------------------
> > >>>> Program received signal SIGSEGV, Segmentation fault.
> > >>>> [Switching to Thread 3184.0xe48]
> > >>>> 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> (gdb) bt
> > >>>> #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> > >>>> C:\Windows\SysWOW64\ntdll.dll
> > >>>> #2  0x76b698cd in msvcrt!free () from
> > >>>> C:\Windows\syswow64\msvcrt.dll
> > >>>> #3  0x17a70000 in ?? ()
> > >>>> #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70,
> > >>>> __in_chrg=<optimized
> > > out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctav
> > >>>> e/
> > >>>> a
> > >>>> rr
> > >>>> ay/
> > >>>> Array.h:89
> > >>>> #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctav
> > >>>> e/
> > >>>> a
> > >>>> rr
> > >>>> ay/
> > >>>> Array.h:223
> > >>>> #6  0x011e3b83 in ~MArray (this=0x1bb13a40, __in_chrg=<optimized
> out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctav
> > >>>> e/
> > >>>> a
> > >>>> rr
> > >>>> ay/
> > >>>> MArray.h:63
> > >>>> #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctav
> > >>>> e/
> > >>>> a
> > >>>> rr
> > >>>> ay/
> > >>>> dNDArray.h:35
> > >>>> #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinter
> > >>>> p/
> > >>>> o
> > >>>> ct
> > >>>> ave
> > >>>> -value/ov-base-mat.h:68
> > >>>> #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> > >>>>   at
> > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libinter
> > >>>> p/
> > >>>> o
> > >>>> ct
> > >>>> ave
> > >>>> -value/ov-re-mat.h:97
> > >>>>
> > >>>> Any ideas what I could try?
> > >>>> Thank you, Andy
> > >>>>
> > >>>
> > >>> My initial thought would be that the ?clear m? in the test script
> > >>> is
> > >> forcing the
> > >>> destructor to be called and it is possible that stuff is still
> > >>> going on in
> > >> the encoding
> > >>> process (ffmpeg is sometimes multithreaded depending on the codec,
> > >>> and
> > >> there
> > >>> could still be file IO going on).
> > >>>
> > >>> As a first test, I would put a big delay (say 5-10 seconds)
> > >>> between the
> > >> ?endfor'
> > >>> and the ?clear m'  in the avifile test. If it is just a matter of
> > >>> trying
> > >> to delete the
> > >>> ffmpeg codec and other objects before they are ready to be
> > >>> deleted, that
> > >> could
> > >>> cause a segfault. I know there is a chunk of code just previous to
> > >>> the
> > >> segfault
> > >>> location that *should be* cleaning things up before closing
> > >>> everything,
> > >> but
> > >>> maybe it isn?t cleaning up correctly?
> > >>>
> > >>> John S.
> > >>>
> > >>
> > >>
> > >> Ok - I can see it on my build as well - it doesn't happen all the
> > >> time
> > >>
> > >> I used to see it crash on calling avifile before 1.2.1, but don't
> > >> seem to
> > > see it
> > >> there anymore, but do see it when running the video test script
> > >
> > > Not sure if this solves it, but ...
> > >
> > > Looking at the video package source code:
> > > AviFile has a copy constructor that is private, so normally wont be used.
> > > However I beleive the default AviFile constructor DOES use it  with
> > > *this=AviFile("default.avi")
> > >
> > > The copy constructor blindly sets 'av' to point to the same value as
> > > what the other constructor, so when it frees all the
> > > octave_base_value objects, it has multiple base value objects trying
> > > to free the same 'av’ pointer
> > >
> >
> > That may be a problem, but I don’t think the default constructor is
> > ever being called during the avifile test and I don’t ever see the
> > warning "avifile: copy constructor shouldn't be called” that should
> > occur if the copy constructor was actually being called.
>
> Isnt the '=' operator going to do a similar thing - its going to blindly copy the av
> pointer between objects


I just attached the patch to Bug 46833 that I applied to the released package of video - no crashes with the addframe test


Reply | Threaded
Open this post in threaded view
|

RE: Request help debugging octave-video in mxe-octave

John Donoghue-3


> -----Original Message-----
> From: JohnD [mailto:[hidden email]]
> Sent: Thursday, January 07, 2016 4:39 PM
> To: 'John Swensen'
> Cc: [hidden email]; 'Andreas Weber'
> Subject: RE: Request help debugging octave-video in mxe-octave
>
>
>
> > -----Original Message-----
> > From: JohnD [mailto:[hidden email]]
> > Sent: Thursday, January 07, 2016 4:27 PM
> > To: 'John Swensen'
> > Cc: [hidden email]; 'Andreas Weber'
> > Subject: RE: Request help debugging octave-video in mxe-octave
> >
> >
> >
> > > -----Original Message-----
> > > From: John Swensen [mailto:[hidden email]]
> > > Sent: Thursday, January 07, 2016 3:19 PM
> > > To: JohnD
> > > Cc: [hidden email]; Andreas Weber
> > > Subject: Re: Request help debugging octave-video in mxe-octave
> > >
> > >
> > > > On Jan 7, 2016, at 12:01 PM, JohnD <[hidden email]>
> > > wrote:
> > > >
> > > >
> > > >
> > > >> -----Original Message-----
> > > >> From: JohnD [mailto:[hidden email]]
> > > >> Sent: Thursday, January 07, 2016 8:02 AM
> > > >> To: [hidden email]
> > > >> Cc: 'John Swensen'; 'Andreas Weber'
> > > >> Subject: Re: Request help debugging octave-video in mxe-octave
> > > >>
> > > >>>
> > > >>> Message: 3
> > > >>> Date: Tue, 5 Jan 2016 10:21:55 -0800
> > > >>> From: John Swensen <[hidden email]>
> > > >>> To: Andreas Weber <[hidden email]>
> > > >>> Cc: octave-maintainers <[hidden email]>
> > > >>> Subject: Re: Request help debugging octave-video in mxe-octave
> > > >>> Message-ID: <9B32F36A-EC93-4D5B-A3B0-
> [hidden email]>
> > > >>> Content-Type: text/plain; charset=utf-8
> > > >>>
> > > >>>
> > > >>>> On Jan 1, 2016, at 10:58 AM, Andreas Weber
> > > >>>> <[hidden email]>
> > > > wrote:
> > > >>>>
> > > >>>> Dear maintainers,
> > > >>>>
> > > >>>> I need some help debugging octave-video with ffmpeg in mxe-octave.
> > > >>>> Sometimes I get a strange segmentation fault in the AVHandler
> > > >> destructor.
> > > >>>>
> > > >>>> What I've done so far:
> > > >>>> Crosscompile mxe-octave on Debian Jessie with $ ./configure
> > > >>>> --disable-strip-dist-files --enable-devel-tools
> > > >>>> --enable-binary-packages $ make gdb ffmpeg zip-dist
> > > >>>>
> > > >>>> In Windows7, extract zip, and grab code from
> > > >>>> http://sourceforge.net/p/octave/video/ci/default/tree/
> > > >>>> run octave in CLI mode, getpid, attach gdb.
> > > >>>>
> > > >>>> Back in Octave:
> > > >>>>>> cd octave/video/src
> > > >>>>>> test avifile
> > > >>>>
> > > >>>> This sometimes works (PASS 1/1) and sometimes fails at
> > > >>>> different
> > > > places:
> > > >>>>
> > > >>>> ----------------------------------------------------
> > > >>>> Program received signal SIGSEGV, Segmentation fault.
> > > >>>> [Switching to Thread 2648.0x7f4]
> > > >>>> 0x7795e3c6 in ntdll!RtlInitUnicodeString () from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> (gdb)
> > > >>>> Continuing.
> > > >>>>
> > > >>>> --------------------------------------------------
> > > >>>> Program received signal SIGSEGV, Segmentation fault.
> > > >>>> [Switching to Thread 3212.0xe9c]
> > > >>>> 0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> (gdb) bt
> > > >>>> #0  0x77963aa8 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> #1  0x77962c7a in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> #2  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> #3  0x76b698cd in msvcrt!free () from
> > > >>>> C:\Windows\syswow64\msvcrt.dll
> > > >>>> #4  0x17aa0000 in ?? ()
> > > >>>> #5  0x1c0159fe in avpriv_mpa_decode_header ()  from
> > > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > >>>> #6  0x1c3bcce9 in avcodec-56!av_dct_end ()  from
> > > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > >>>> #7  0x1c3ce86e in avcodec_close ()  from
> > > >>>> C:\octave-dbg\octave-4.0.0\bin\avcodec-56.dll
> > > >>>> #8  0x6660167c in AVHandler::~AVHandler (this=0x1bacd708,
> > > >>>>   __in_chrg=<optimized out>) at AVHandler.cc:83
> > > >>>> #9  0x6660384a in Avifile::~Avifile (this=0x1bc20c90,
> > > >>>>
> > > >>>> ---------------------------------------------------------
> > > >>>> Program received signal SIGSEGV, Segmentation fault.
> > > >>>> [Switching to Thread 3184.0xe48]
> > > >>>> 0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> (gdb) bt
> > > >>>> #0  0x77962e33 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> #1  0x77962b65 in ntdll!RtlQueryPerformanceCounter ()  from
> > > >>>> C:\Windows\SysWOW64\ntdll.dll
> > > >>>> #2  0x76b698cd in msvcrt!free () from
> > > >>>> C:\Windows\syswow64\msvcrt.dll
> > > >>>> #3  0x17a70000 in ?? ()
> > > >>>> #4  0x0128b8bc in ~ArrayRep (this=0x1bbfaa70,
> > > >>>> __in_chrg=<optimized
> > > > out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboct
> > > >>>> av
> > > >>>> e/
> > > >>>> a
> > > >>>> rr
> > > >>>> ay/
> > > >>>> Array.h:89
> > > >>>> #5  Array<double>::~Array (this=0x0, __in_chrg=<optimized out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboct
> > > >>>> av
> > > >>>> e/
> > > >>>> a
> > > >>>> rr
> > > >>>> ay/
> > > >>>> Array.h:223
> > > >>>> #6  0x011e3b83 in ~MArray (this=0x1bb13a40,
> > > >>>> __in_chrg=<optimized
> > out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboct
> > > >>>> av
> > > >>>> e/
> > > >>>> a
> > > >>>> rr
> > > >>>> ay/
> > > >>>> MArray.h:63
> > > >>>> #7  ~NDArray (this=0x1bb13a40, __in_chrg=<optimized out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboct
> > > >>>> av
> > > >>>> e/
> > > >>>> a
> > > >>>> rr
> > > >>>> ay/
> > > >>>> dNDArray.h:35
> > > >>>> #8  ~octave_base_matrix (this=0x1bb13a38, __in_chrg=<optimized
> out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libint
> > > >>>> er
> > > >>>> p/
> > > >>>> o
> > > >>>> ct
> > > >>>> ave
> > > >>>> -value/ov-base-mat.h:68
> > > >>>> #9  ~octave_matrix (this=0x1bb13a38, __in_chrg=<optimized out>)
> > > >>>>   at
> > > >>>> /home/andy/src/mxe-octave/tmp-stable-octave/octave-4.0.0/libint
> > > >>>> er
> > > >>>> p/
> > > >>>> o
> > > >>>> ct
> > > >>>> ave
> > > >>>> -value/ov-re-mat.h:97
> > > >>>>
> > > >>>> Any ideas what I could try?
> > > >>>> Thank you, Andy
> > > >>>>
> > > >>>
> > > >>> My initial thought would be that the ?clear m? in the test
> > > >>> script is
> > > >> forcing the
> > > >>> destructor to be called and it is possible that stuff is still
> > > >>> going on in
> > > >> the encoding
> > > >>> process (ffmpeg is sometimes multithreaded depending on the
> > > >>> codec, and
> > > >> there
> > > >>> could still be file IO going on).
> > > >>>
> > > >>> As a first test, I would put a big delay (say 5-10 seconds)
> > > >>> between the
> > > >> ?endfor'
> > > >>> and the ?clear m'  in the avifile test. If it is just a matter
> > > >>> of trying
> > > >> to delete the
> > > >>> ffmpeg codec and other objects before they are ready to be
> > > >>> deleted, that
> > > >> could
> > > >>> cause a segfault. I know there is a chunk of code just previous
> > > >>> to the
> > > >> segfault
> > > >>> location that *should be* cleaning things up before closing
> > > >>> everything,
> > > >> but
> > > >>> maybe it isn?t cleaning up correctly?
> > > >>>
> > > >>> John S.
> > > >>>
> > > >>
> > > >>
> > > >> Ok - I can see it on my build as well - it doesn't happen all the
> > > >> time
> > > >>
> > > >> I used to see it crash on calling avifile before 1.2.1, but don't
> > > >> seem to
> > > > see it
> > > >> there anymore, but do see it when running the video test script
> > > >
> > > > Not sure if this solves it, but ...
> > > >
> > > > Looking at the video package source code:
> > > > AviFile has a copy constructor that is private, so normally wont be used.
> > > > However I beleive the default AviFile constructor DOES use it
> > > > with
> > > > *this=AviFile("default.avi")
> > > >
> > > > The copy constructor blindly sets 'av' to point to the same value
> > > > as what the other constructor, so when it frees all the
> > > > octave_base_value objects, it has multiple base value objects
> > > > trying to free the same 'av’ pointer
> > > >
> > >
> > > That may be a problem, but I don’t think the default constructor is
> > > ever being called during the avifile test and I don’t ever see the
> > > warning "avifile: copy constructor shouldn't be called” that should
> > > occur if the copy constructor was actually being called.
> >
> > Isnt the '=' operator going to do a similar thing - its going to
> > blindly copy the av pointer between objects
>
>
> I just attached the patch to Bug 46833 that I applied to the released package of
> video - no crashes with the addframe test


I guess I will take that back - the constructor or '=' wasn’t the issue, I had 2 changes in the files - the other being in AVHandler.cc, changing the video_outbuff = malloc to the video_outbuff = av_malloc.

On just changing the devel code for the av_malloc, it doesn’t crash, so I guess that is the issue - the free of the memory is using av_free.

It might be good to remove the default contructor still and use a default value for AviFile::AviFile(std::string fn) to make it a default.




Reply | Threaded
Open this post in threaded view
|

Re: Request help debugging octave-video in mxe-octave

Andreas Weber-4
Am 08.01.2016 um 14:35 schrieb JohnD:

> I guess I will take that back - the constructor or '=' wasn’t the issue, I had 2 changes in the files - the other being in AVHandler.cc, changing the video_outbuff = malloc to the video_outbuff = av_malloc.
>
> On just changing the devel code for the av_malloc, it doesn’t crash, so I guess that is the issue - the free of the memory is using av_free.
>
> It might be good to remove the default contructor still and use a default value for AviFile::AviFile(std::string fn) to make it a default.

Hi JohnD,
I changed malloc->av_malloc in cset 7c672add6a04
and removed the void c'tor and used default arguments in 7c672add6a04.
I also decided to empty the copy constructor because it should never be
called from the user visible functions (only print a message).

Thank you for your help, Andy