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 759286 - videoconvert/videotestsrc get SIGSEGV on 1.6.0 when ORC enabled on ARM A9 platform
videoconvert/videotestsrc get SIGSEGV on 1.6.0 when ORC enabled on ARM A9 pla...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: orc
0.4.23
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-10 06:31 UTC by Mingke Wang
Modified: 2018-11-03 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
script for loop (409 bytes, application/x-shellscript)
2015-12-10 06:31 UTC, Mingke Wang
  Details
disable orc in gst base video (666 bytes, patch)
2015-12-10 06:34 UTC, Mingke Wang
none Details | Review

Description Mingke Wang 2015-12-10 06:31:46 UTC
Created attachment 317087 [details]
script for loop

We recently upgrade gstreamer from 1.4.5 to gstreamer 1.6.0 and we got a crash (SIGSEGV) problem in videotestsrc and videoconvert.
Platform: ARM A9 (Freescale I.MAX6Q)
Software: Gstreamer 1.6.0 + liborc-0.4.23

command line: 
by loop following (check the attached loop.sh):
gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,format=I420 !
videoconvert ! fakesink
or even
gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,format=I420 ! fakesink


the backtrack is :
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Caught SIGSEGV
  • #0 poll
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 g_main_context_iterate
  • #2 g_main_context_iterate
  • #3 g_main_loop_run
  • #4 gst_bus_poll
  • #5 event_loop
  • #6 main

the crash time is not fix, sometime only need loop several times, sometimes need loop several minutes.

Gstreamer 1.4.5 has no problem.
Gstreamer 1.6.0 on PC platform has no problem

by further investigation, the crash should comes from vidoe-orc.orc, when I disable the ORC in video-orc.orc (check the attached patch), then it works fine.

updating the liborc to 0.4.24 helps nothing.
Comment 1 Mingke Wang 2015-12-10 06:34:12 UTC
Created attachment 317088 [details] [review]
disable orc in gst base video
Comment 2 Sebastian Dröge (slomo) 2015-12-10 08:09:12 UTC
Can you get a backtrace of all threads when it crashes? Also make sure to install debug symbols for libc, glib, gstreamer, gst-plugins-base and orc.
Comment 3 Mingke Wang 2015-12-10 08:56:37 UTC
new found: if enable the ORC debugging by export ORC_DEBUG=5, crash gone
Comment 4 Nicolas Dufresne (ndufresne) 2015-12-10 14:14:23 UTC
Please try with latest ORC.
Comment 5 Tim-Philipp Müller 2015-12-10 14:24:25 UTC
You can also disable orc at run-time by using ORC_CODE=backup as environment variable.

The stack trace is not very useful, it's the wrong thread, not the thread that crashes. With

(gdb) threads apply all bt

you can get the state of all threads.
Comment 6 Mingke Wang 2015-12-11 03:15:51 UTC
backtrace of all threads:

(gdb) info th
  Id   Target Id         Frame
  3    Thread 0x768b6460 (LWP 1183) "videotestsrc0:s" 0x76cd2cb4 in nanosleep () at ../sysdeps/unix/syscall-template.S:84
  2    Thread 0x75eff460 (LWP 1184) "gmain" 0x76c473c4 in poll () at ../sysdeps/unix/syscall-template.S:84
* 1    Thread 0x76fb9210 (LWP 1170) "gst-launch-1.0" 0x76c473c4 in poll () at ../sysdeps/unix/syscall-template.S:84
(gdb) t 2
[Switching to thread 2 (Thread 0x75eff460 (LWP 1184))]
  • #0 poll
    at ../sysdeps/unix/syscall-template.S line 84
  • #0 poll
    at ../sysdeps/unix/syscall-template.S line 84
  • #1 g_main_context_iterate
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gmain.c line 4103
  • #2 g_main_context_iterate
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gmain.c line 3803
  • #3 g_main_context_iteration
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gmain.c line 3869
  • #4 glib_worker_main
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gmain.c line 5618
  • #5 g_thread_proxy
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gthread.c line 764
  • #6 start_thread
    at pthread_create.c line 339
  • #7 0x76c542f0 in
    at ../sysdeps/unix/sysv/linux/arm/clone.S line 89
  • #0 nanosleep
    at ../sysdeps/unix/syscall-template.S line 84
  • #0 nanosleep
    at ../sysdeps/unix/syscall-template.S line 84
  • #1 g_usleep
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gtimer.c line 259
  • #2 fault_handler_sighandler
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/tools/gst-launch.c line 112
  • #3 fault_handler_sighandler
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/tools/gst-launch.c line 93
  • #4 <signal handler called>
  • #5 0x76f7e720 in
  • #6 video_orc_pack_Y
    at tmp-orc.c line 1390
  • #7 convert_hline_generic
    at /usr/src/debug/gstreamer1.0-plugins-base/1.6.0-r0/gst-plugins-base-1.6.0/gst/videotestsrc/videotestsrc.c line 1199
  • #8 videotestsrc_convert_tmpline
    at /usr/src/debug/gstreamer1.0-plugins-base/1.6.0-r0/gst-plugins-base-1.6.0/gst/videotestsrc/videotestsrc.c line 275
  • #9 gst_video_test_src_smpte
    at /usr/src/debug/gstreamer1.0-plugins-base/1.6.0-r0/gst-plugins-base-1.6.0/gst/videotestsrc/videotestsrc.c line 352
  • #10 gst_video_test_src_fill
    at /usr/src/debug/gstreamer1.0-plugins-base/1.6.0-r0/gst-plugins-base-1.6.0/gst/videotestsrc/gstvideotestsrc.c line 954
  • #11 gst_base_src_default_create
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/libs/gst/base/gstbasesrc.c line 1482
  • #12 gst_base_src_get_range
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/libs/gst/base/gstbasesrc.c line 2455
  • #13 gst_base_src_loop
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/libs/gst/base/gstbasesrc.c line 2731
  • #14 gst_task_func
    at /usr/src/debug/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/gst/gsttask.c line 331
  • #15 g_thread_pool_thread_proxy
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gthreadpool.c line 307
  • #16 g_thread_proxy
    at /usr/src/debug/glib-2.0/1_2.44.1-r0/glib-2.44.1/glib/gthread.c line 764
  • #17 start_thread
    at pthread_create.c line 339
  • #18 () at ../sysdeps/unix/sysv/linux/arm/clone.S:89

Comment 7 Nicolas Dufresne (ndufresne) 2015-12-11 14:13:52 UTC
This trace does not show any crash either. Are you sure of what you are reporting ?
Comment 8 Sebastian Dröge (slomo) 2015-12-11 14:23:44 UTC
Nicolas, if you expand the stack trace and look further down you'll see the crash. It's in video_orc_pack_Y
Comment 9 Nicolas Dufresne (ndufresne) 2015-12-11 15:08:14 UTC
Sorry, got confused by the nanosleep we use in our signal handler. On my side, I still can't reproduce on a similar CPU. Maybe we'll need a valgrind trace ? I wonder if a copy of the tmp-orc.c would help (it's at line 1390).
Comment 10 Sebastian Dröge (slomo) 2015-12-11 15:13:03 UTC
It looks like it's in the JIT generated code
Comment 11 Mingke Wang 2015-12-14 01:51:36 UTC
void
video_orc_pack_Y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n)
{
  OrcExecutor _ex, *ex = &_ex;
  static volatile int p_inited = 0;
  static OrcCode *c = 0;
  void (*func) (OrcExecutor *);

  if (!p_inited) {
    orc_once_mutex_lock ();
    if (!p_inited) {
      OrcProgram *p;

#if 1
      static const orc_uint8 bc[] = {
        1, 9, 16, 118, 105, 100, 101, 111, 95, 111, 114, 99, 95, 112, 97, 99, 
        107, 95, 89, 11, 1, 1, 12, 4, 4, 20, 2, 190, 32, 4, 189, 0, 
        32, 2, 0, 
      };
      p = orc_program_new_from_static_bytecode (bc);
      orc_program_set_backup_function (p, _backup_video_orc_pack_Y);
#else
      p = orc_program_new ();
      orc_program_set_name (p, "video_orc_pack_Y");
      orc_program_set_backup_function (p, _backup_video_orc_pack_Y);
      orc_program_add_destination (p, 1, "d1");
      orc_program_add_source (p, 4, "s1");
      orc_program_add_temporary (p, 2, "t1");

      orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1);
      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
#endif

      orc_program_compile (p);
      c = orc_program_take_code (p);
      orc_program_free (p);
    }
    p_inited = TRUE;
    orc_once_mutex_unlock ();
  }
  ex->arrays[ORC_VAR_A2] = c;
  ex->program = 0;

  ex->n = n;
  ex->arrays[ORC_VAR_D1] = d1;
  ex->arrays[ORC_VAR_S1] = (void *)s1;

  func = c->exec;
  func (ex);
}
#endif

that's the video_orc_pack_Y in tmp-orc.c and the line 1390 is "func (ex)",
the interest thing is that when I enable the ORC debugging by ORC_DEBUG=5, then no crash (at least for 3 hours running, I didn't test longer)
Comment 12 Florian Vallee 2016-11-29 14:21:16 UTC
Hi All,

I've hit the same issue with various Cortex A9 boards (all i.MX based)
* Freescale iMX6QP sdb
* Wandboard solo

While troubleshooting I have come up with a similar test-case which fails every minute or so :

while [ 1 ]; do
  gst-launch-1.0 videotestsrc num-buffers=1 ! filesink location=/dev/null
done

This is on a yocto krogoth system running the following versions of gst/orc : 
$ gst-launch-1.0 --version
gst-launch-1.0 version 1.6.3
GStreamer 1.6.3

$ orcc --version
Orc Compiler 0.4.24

Is there anything else I can do to help troubleshoot the issue ?

@Mingke I'm not sure that the fact that you did not see the issue with ORC_DEBUG=5 is relevant. This slows down processing by a lot due to prints. On my system setting ORC_DEBUG=5 and redirecting stdout / stderr to /dev/null trigerred the crash as well :

while [ 1 ]; do
  gst-launch-1.0 videotestsrc num-buffers=1 ! filesink location=/dev/null &>/dev/null
  echo "still alive $?"
done
Comment 13 Nicolas Dufresne (ndufresne) 2016-11-29 14:54:42 UTC
I can reproduce on a Snapdragon 600 (currently running 1.10.0).
Comment 14 Nicolas Dufresne (ndufresne) 2016-11-29 14:55:58 UTC
Running ORC 0.4.26, so it's not an old bug.
Comment 15 Edward Hervey 2018-05-07 14:27:37 UTC
Nicolas, can you still reproduce with current gstreamer and orc ?
Comment 16 Haihua Hu 2018-08-23 08:57:11 UTC
Still can reproduce this issue with gstreamer-1.14 on imx 6Q board
Comment 17 Haihua Hu 2018-08-23 08:57:31 UTC
Still can reproduce this issue with gstreamer-1.14 on imx 6Q board
Comment 18 Sebastian Dröge (slomo) 2018-08-27 06:12:46 UTC
This needs debugging by someone with access to the actual hardware.
Comment 19 GStreamer system administrator 2018-11-03 10:48:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/orc/issues/11.