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 420106 - [basetransform] race on shutdown: setcaps func called after pad set flushing
[basetransform] race on shutdown: setcaps func called after pad set flushing
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.12
Other Linux
: Normal critical
: 0.10.13
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 412851 419808 430522 432358 450620 459043 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-03-19 13:29 UTC by Sebastien Bacher
Modified: 2007-07-25 14:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Make sure streaming has finished before calling GstBaseTransform::stop() which might clear state (835 bytes, patch)
2007-04-21 13:20 UTC, Tim-Philipp Müller
committed Details | Review

Description Sebastien Bacher 2007-03-19 13:29:18 UTC
The bug has been opened on https://launchpad.net/bugs/93282

"Binary package hint: totem

Well, I was trying to read a movie with totem, I already opened it successfully with Totem (avi + subtitles). But this time, Totem couldn't start properly and was closing just after the start and a "could not initialize" message. I started Totem again and again and it crashed. I cannot reproduce it as totem is now working fine again.

ProblemType: Crash
Architecture: i386
Date: Sun Mar 18 04:22:14 2007
DistroRelease: Ubuntu 7.04
ExecutablePath: /usr/bin/totem
Package: totem-gstreamer 2.18.0-0ubuntu1
PackageArchitecture: i386
ProcCmdline: totem file:///home/pthivent/My%20Videos/lost.312.hdtv-caph.avi
...
.

Thread 11 (process 20695)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??
  • #3 ??
  • #4 ??

Thread 10 (process 20697)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 9 (process 20698)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 8 (process 20699)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 7 (process 20700)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 6 (process 20701)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 5 (process 20702)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 4 (process 20703)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 3 (process 20705)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 2 (process 20706)

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 ??
  • #2 ??

Thread 1 (process 20704)

  • #0 resample_set_format
    at resample.c line 288
  • #1 resample_set_state_from_caps
    at gstaudioresample.c line 328
  • #2 audioresample_set_caps
    at gstaudioresample.c line 430
  • #3 gst_base_transform_configure_caps
    at gstbasetransform.c line 625
  • #4 gst_base_transform_setcaps
    at gstbasetransform.c line 803
  • #5 gst_pad_set_caps
    at gstpad.c line 2362
  • #6 gst_pad_chain_unchecked
    at gstpad.c line 2421
  • #7 gst_pad_push
    at gstpad.c line 3625
  • #8 gst_base_transform_chain
    at gstbasetransform.c line 1571
  • #9 gst_pad_chain_unchecked
    at gstpad.c line 3459
  • #10 gst_pad_push
    at gstpad.c line 3625
  • #11 gst_proxy_pad_do_chain
    at gstghostpad.c line 191
  • #12 gst_pad_chain_unchecked
    at gstpad.c line 3459
  • #13 gst_pad_push
    at gstpad.c line 3625
  • #14 gst_queue_loop
    at gstqueue.c line 810
  • #15 gst_task_func
    at gsttask.c line 192
  • #16 g_thread_pool_thread_proxy
    at gthreadpool.c line 265
  • #17 g_thread_create_proxy
    at gthread.c line 591
  • #18 ??
  • #19 ??
  • #20 ??
  • #21 ??
  • #22 ??
  • #23 ??
  • #24 ??

Comment 1 Daniel Holbach 2007-03-27 15:12:53 UTC
http://librarian.launchpad.net/6995855/%3Cfdopen%3E has a similar backtrace coming from rhythmbox.
Comment 2 Tim-Philipp Müller 2007-03-30 09:07:23 UTC
> http://librarian.launchpad.net/6995855/%3Cfdopen%3E has a similar backtrace
> coming from rhythmbox.

Very useful, thanks!


So, I wonder if the following race(?) could happen when a GstBaseTransform-based element's state goes from PAUSED => READY:

 Streaming-Thread: in gst_pad_chain_unchecked():
                    - take STREAM_LOCK
                    - take OBJECT_LOCK
                    - check if pad is flushing
                    - release OBJECT_LOCK

 Shutdown-Thread:  in gst_pad_activate_push(FALSE):
                    - take OBJECT_LOCK    (in pre_activate)
                    - set pad to flushing (in pre_activate)
                    - release OBJECT_LOCK (in pre_activate)
                    - call GST_PAD_ACTIVATEPUSHFUNC(), which was
                      set by GstBaseTransform and which will call
                      GstBaseTransform::stop() where elements
                      might clear all their state.

 Streaming-Thread: still in gst_pad_chain_unchecked():
                    - call gst_pad_configure_sink() which will/might cause
                      GstBaseTransform::set_caps() to be called, which
                      elements will only expect after they have been
                      started again and their state has been initialised

Or am I missing anything here? If not, core bug, basetransform bug or element bug?
Comment 3 Sebastien Bacher 2007-03-31 13:10:22 UTC
another totem crash on https://launchpad.net/bugs/99388, the description:

"Totem crashes when you select more than one file in nautilus and press enter. The default user want's to make a playlist in this way and it would be nice if you can fix it.
..."

Do you need some GST_DEBUG log?
Comment 4 Tim-Philipp Müller 2007-04-10 11:40:44 UTC
Core bug, me thinks. Bug #412870 might also be related.
Comment 5 Wim Taymans 2007-04-17 15:18:46 UTC
basetransform should not call stop before the STREAM_LOCK has been acquired.
Comment 6 Tim-Philipp Müller 2007-04-21 13:20:16 UTC
Created attachment 86740 [details] [review]
Make sure streaming has finished before calling GstBaseTransform::stop() which might clear state
Comment 7 Tim-Philipp Müller 2007-04-21 13:55:19 UTC
Fixed in core:

 2007-04-21  Tim-Philipp Müller  <tim at centricular dot net>

       * libs/gst/base/gstbasetransform.c: (gst_base_transform_activate):
         Make sure streaming has stopped before calling the ::stop() vfunc,
         since that vfunc might clear state which is being used in the
         streaming thread. This fixes a race that caused crashes in
         audioresample when shutting down a pipeline (#420106).


Also committed unit test to gst-plugins-base:

 2007-04-21  Tim-Philipp Müller  <tim at centricular dot net>

        * tests/check/elements/audioresample.c:
          Add unit test for audioresample shutdown crasher (#420106).

Comment 8 Tim-Philipp Müller 2007-04-21 14:04:13 UTC
*** Bug 430522 has been marked as a duplicate of this bug. ***
Comment 9 Tim-Philipp Müller 2007-04-21 14:08:21 UTC
*** Bug 419808 has been marked as a duplicate of this bug. ***
Comment 10 Tim-Philipp Müller 2007-04-21 14:09:55 UTC
*** Bug 412851 has been marked as a duplicate of this bug. ***
Comment 11 Jonathan Matthew 2007-04-23 23:01:32 UTC
*** Bug 432358 has been marked as a duplicate of this bug. ***
Comment 12 Pedro Villavicencio 2007-06-24 22:46:01 UTC
*** Bug 450620 has been marked as a duplicate of this bug. ***
Comment 13 Jonathan Matthew 2007-07-25 14:42:04 UTC
*** Bug 459043 has been marked as a duplicate of this bug. ***