After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760266 - avenc_mpeg4/mpeg2video: Segmentation fault when stopping the pipeline
avenc_mpeg4/mpeg2video: Segmentation fault when stopping the pipeline
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
1.7.1
Other Windows
: Normal major
: 1.8.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-07 13:06 UTC by Mikhaylo
Modified: 2016-04-26 08:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
error picture (21.18 KB, image/png)
2016-01-07 15:06 UTC, Mikhaylo
Details

Description Mikhaylo 2016-01-07 13:06:21 UTC
OS: Windows 10
Gstreamer 1.7.1 x64

follow steps will raise exception once there is an attempt to close gstreamer

Steps:
1) Open cmd
2) launch "gst-launch-1.0 videotestsrc ! avenc_mpeg4 ! rtpmp4vpay ! fakesink"
3) Wait till encoding started
4) push Ctrl+C

Expected result: Encoding interrupted
Actual result - Gstreamer Exception
Short video with the steps and the error : 
http://screencast.com/t/oOKSUilrJc

There is the same problem is call "Pipeline.SetState(State.Null);" in C# bindings
Comment 1 Sebastian Dröge (slomo) 2016-01-07 14:48:23 UTC
Can you upload that to a website that does not require flash? Also ideally you could get a backtrace of the crash with gdb :) Thanks!
Comment 2 Mikhaylo 2016-01-07 15:06:55 UTC
Created attachment 318421 [details]
error picture
Comment 3 Sebastian Dröge (slomo) 2016-01-07 15:09:11 UTC
Ok, we would need a backtrace (of all threads) with gdb here
Comment 4 Mikhaylo 2016-01-08 08:21:47 UTC
Ok, the dmp is here

https://www.dropbox.com/s/56kk4wapqqacb95/gst-launch-1.0.exe_160108_101219.dmp?dl=0


I got it using "procdump.exe -mp -e -t -64 gst-launch-1.0"
Comment 5 Sebastian Dröge (slomo) 2016-01-08 14:45:11 UTC
That's not going to be useful as the binaries only have gdb compatible debug symbols. Please run your application in gdb and get a backtrace (of all threads) from there
Comment 6 Mikhaylo 2016-01-08 14:50:25 UTC
I am not sure I understand what application you mean

I run 
gst-launch-1.0.exe from windows command line console (cmd)
with parameters "videotestsrc ! avenc_mpeg4 ! rtpmp4vpay ! fakesink"

and then once I want to terminate gstreamer and push Ctrl+C (windows key combination to terminate the execution on command line console) I have the error on the screenshot attached above
Comment 7 Sebastian Dröge (slomo) 2016-01-08 15:20:17 UTC
I'm talking about gdb, the GNU debugger.
Comment 8 Mikhaylo 2016-01-09 09:11:01 UTC
I installed mingw (gdb for windows) and wingdb (UI over gdb for Vidual Studio). But I cannot figure out how to get exception tree, since the exception happens not during execution, it happens on exit from programm.

I am really willing to get this details for and have it fixed. So I am ready to follow some steps to get the trace you need or to provide you access to windows PC if you don't have one to try on your side.
Comment 9 Sebastian Dröge (slomo) 2016-01-09 09:53:55 UTC
I can reproduce the problem on Windows and it's not a normal crash that is caught by gdb apparently.

Doesn't crash on Linux with the same pipeline. valgrind also doesn't report anything suspicious there.
Comment 10 Sebastian Dröge (slomo) 2016-01-09 09:56:00 UTC
Last thing seen in the logs is gst_ffmpegvidenc_flush_buffers(), and then an assertion in libavutil/mem.c:233: v > 0 && v <= (1 ? 32 : 16)
Comment 11 Mikhaylo 2016-01-09 10:18:57 UTC
libavutil/mem.c is it a part of gstreamer or libav ? Can it be fixed by gstreamer team, or it should be reported to libav ?
Also do you see there any workaround to prevent the exception?

So far I found if I call in my C# application
Pipeline.SetState(State.Paused);
instead of
Pipeline.SetState(State.Null);
that not raises exception and stops encoding correctly, but that causes a memmory leak.
Comment 12 Sebastian Dröge (slomo) 2016-01-09 14:18:32 UTC
It's libav/ffmpeg code. But it's not clear yet if it's a bug on our side or theirs
Comment 13 Mikhaylo 2016-01-20 17:10:52 UTC
Is there any chance the fix could be included in the upcoming 1.8 release ?
Comment 14 Sebastian Dröge (slomo) 2016-02-17 12:14:32 UTC
If a fix is found, sure. Someone would have to invest the time in that though and there are lots of other things to do too.
Comment 15 Sebastian Dröge (slomo) 2016-04-25 15:40:59 UTC
commit 2027188c34698842c38b38f87f5560b08d7861dd
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Mon Apr 25 18:39:54 2016 +0300

    avcfg: Use av_strdup() instead of g_strdup() for strings owned by ffmpeg
    
    It has its own allocator that depending on the configuration is incompatible
    with GLib's and just causes a segmentation fault. Like on Windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760266