GNOME Bugzilla – Bug 784604
SegFault streaming video on Ubuntu 16.04
Last modified: 2017-07-07 02:01:09 UTC
I am not sure if this is specific to Ubuntu 16.04 but that is where I am running on. I am trying to use GStreamer within my application running on Ubuntu 16.04 to send some video frames over to QGC (QuadGroundControl) to view the video. I am getting a seg fault and do not know where to go from here. I am opening a bug hoping there is an easy fix in GStreamer or perhaps someone can tell me if I am missing something. Thread 34 "source:src" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ff054ed8700 (LWP 20972)] 0x00007ff07506de63 in ?? () from /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 (gdb) where
+ Trace 237619
Not sure if this is related but the rest of the threads look like this 13 Thread 0x7fb9cac12700 (LWP 25718) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 I see this at the top Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". c pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 185 ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
Here are all the threads in the core dump Id Target Id Frame 1 Thread 0x7fb9d8a71780 (LWP 25699) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 2 Thread 0x7fb9d71a9700 (LWP 25706) "hee" 0x00007fb9d74e9b26 in __GI___sigwaitinfo (set=<optimized out>, info=0x7fb9d71a8e30) at ../sysdeps/unix/sysv/linux/sigwaitinfo.c:56 3 Thread 0x7fb9d8a6f700 (LWP 25707) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 4 Thread 0x7fb9d89ca700 (LWP 25708) "hee" 0x00007fb9d74e8730 in __sigprocmask (how=0, set=0x7fb9d89c50a0, oset=0x7fb9d89c5020) at ../sysdeps/unix/sysv/linux/x86_64/sigprocmask.c:36 5 Thread 0x7fb9d8969700 (LWP 25709) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 6 Thread 0x7fb9d8908700 (LWP 25710) "hee" 0x00007fb9d75afabc in __pselect (nfds=13, readfds=0x7fb9d8907730, writefds=0x0, exceptfds=0x0, timeout=<optimized out>, sigmask=<optimized out>) at ../sysdeps/unix/sysv/linux/pselect.c:69 7 Thread 0x7fb9caeb9700 (LWP 25711) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 8 Thread 0x7fb9cae58700 (LWP 25712) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 9 Thread 0x7fb9cad96700 (LWP 25714) "hee" 0x00007fb9d8466c1d in nanosleep () at ../sysdeps/unix/syscall-template.S:84 10 Thread 0x7fb9cad35700 (LWP 25715) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 11 Thread 0x7fb9cacd4700 (LWP 25716) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 12 Thread 0x7fb9cac73700 (LWP 25717) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 13 Thread 0x7fb9cac12700 (LWP 25718) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 14 Thread 0x7fb9cabb1700 (LWP 25719) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 15 Thread 0x7fb9cab50700 (LWP 25720) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 16 Thread 0x7fb9caaef700 (LWP 25721) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 17 Thread 0x7fb9caa8e700 (LWP 25727) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 18 Thread 0x7fb9caa2d700 (LWP 25728) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 19 Thread 0x7fb9ca9cc700 (LWP 25729) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 20 Thread 0x7fb9ca96b700 (LWP 25730) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 21 Thread 0x7fb9ca90a700 (LWP 25731) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 22 Thread 0x7fb9ca8a9700 (LWP 25732) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 23 Thread 0x7fb9ca848700 (LWP 25733) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 24 Thread 0x7fb9ca7e7700 (LWP 25734) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 25 Thread 0x7fb9ca786700 (LWP 25735) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 26 Thread 0x7fb9ca725700 (LWP 25736) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 27 Thread 0x7fb9ca6c4700 (LWP 25737) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 28 Thread 0x7fb9ca663700 (LWP 25738) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 29 Thread 0x7fb9ca602700 (LWP 25739) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 30 Thread 0x7fb9ca5a1700 (LWP 25741) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 31 Thread 0x7fb9ca540700 (LWP 25829) "hee" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 32 Thread 0x7fb9ab83e700 (LWP 25830) "gmain" 0x00007fb9d75adb5d in poll () at ../sysdeps/unix/syscall-template.S:84 33 Thread 0x7fb9ab03d700 (LWP 25831) "pool" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 * 34 Thread 0x7fb9a9e01700 (LWP 25832) "mysource:src" 0x00007fb9c9e42e63 in ?? () from /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 35 Thread 0x7fb9a9580700 (LWP 25833) "vaapiencodeh264" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
Thanks for taking the time to report this. Unfortunately, that stack trace is missing some elements that will help a lot to solve the problem, so it will be hard for the developers to fix that crash. Can you get us a stack trace with debugging symbols? Please see https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces for more information on how to do so and reopen this bug report. Thanks in advance! Please also use "threads apply all bt" to get a backtrace of all threads.
Here is the output for "thread apply all bt"
+ Trace 237620
Thread 35 (Thread 0x7f99950d7700 (LWP 27038))
Thread 33 (Thread 0x7f999698a700 (LWP 27036))
Thread 6 (Thread 0x7f99c449a700 (LWP 26914))
Thread 4 (Thread 0x7f99c455c700 (LWP 26912))
Also, noticed this when gdb was started [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 185 ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory. (gdb) c Continuing.
How can I REOPEN the bug ?
Please do sudo apt-get install gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-good-dbg gstreamer1.0-vaapi-dbgsym libglib2.0-0-dbg and then get a new stack trace, thanks!
Here is your required information: Stack for the thread that got the Seg Fault (gdb) where
+ Trace 237621
Thread 35 (Thread 0x7f3d6cb16700 (LWP 2635))
Thread 34 (Thread 0x7f3d6d317700 (LWP 2634))
Thread 33 (Thread 0x7f3d6e553700 (LWP 2633))
Thread 6 (Thread 0x7f3d9bf77700 (LWP 2371))
Thread 4 (Thread 0x7f3d9c039700 (LWP 2369))
Let me know if there is anything else you need to debug. Looks like an error when trying to Unpack the data in video-format.c file.
Thanks, but not sure what to do with that. Do you get any warnings/criticals printed on stderr when your code runs? Can you reproduce the issue with gst-launch-1.0 or gst-play-1.0 on the command line? Any chance you could try the latest stable version of GStreamer (1.12)? There were a few issues with buffer mappability fixed iirc.
Do you get any warnings/criticals printed on stderr when your code runs? >> No warnings. Just the Seg Fault. Can you reproduce the issue with gst-launch-1.0 or gst-play-1.0 on the command line? >> I cant. The application that runs GStreamer is running on a different machine that the one that is generating the video frames. It sends the frames to my local machine where I receive them and send them to QGC via a gstreamer pipeline. Any chance you could try the latest stable version of GStreamer (1.12)? There were a few issues with buffer mappability fixed iirc. >> I am trying to install the latest version but it defaults to 1.0. I run sudo apt-get update. What are the commands to upgrade to 1.12 ?
Just so I was clear on the gst-launch-1.0 question - As far as I can see, gst-launch-1.0 needs a device name for it to work. My machine where the application runs and gets the Seg Fault is not the one where the device is located. It is just getting the frames and sending them to QGC via Gstreamer.
The bug is clearly on this line of code when it tries to push out the buffer to gstreamer - g_signal_emit_by_name( appsrc, "push-buffer", gstbuffer, &ret ); I commented it out and the application ran fine with no core but obviously did not show any video Anything I can do on my end to debug ? gstbuffer is gstbuffer = gst_buffer_new_wrapped_full( ( GstMemoryFlags )0, frame_ptr, frame_size, 0, frame_size, NULL, NULL );
Perhaps you need to show us more code. I suspect this is a bug in your application, with how memory is handled.
Its possible but I am not quite sure. I say that because when I run the same application from the machine that has the camera located on it, the application runs fine i.e no core. So there is maybe something with Ubuntu 16.04 and Gstreamer that I have installed or something weird going on. I can updated to 1.12. Can you send me the instructions ? Im running ubuntu 16.04.
You could upgrade to ubuntu artful / 17.10 :) Alternatively, perhaps you could try to make a minimal example application that reproduces the problem.
I can try upgrading my local ubuntu machine tomorrow and let you know the results. The application unfortunately is thousands of lines so making it simpler would take a really long time :). I would like to first try and upgrade GStreamer if you could send me the correct sudo apt-get command.
This is something you need to ask for in ubuntu forums I'm afraid, I can't help with that. My best guess is still that this is a problem in your code where you push buffers into the pipeline with appsrc. So you could either make a test app, or show us your code so we can have a look.
I will show you the relevant code tomorrow. Just walked back home now.
Tim, There was something wrong in my application the way it was handling the buffers. I was freeing them up to soon. I think I have it working and get the video. I do not think this is a gstreamer issue anymore. Feel free to close this as perhaps "Invalid" or as you feel appropriate. Thanks for your help on this thou. best Rohan
Thanks for taking the time to report back.