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 643772 - [playsink] Sometimes uses already freed objects leading to crashes
[playsink] Sometimes uses already freed objects leading to crashes
Status: RESOLVED DUPLICATE of bug 642466
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.32
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-03-03 11:41 UTC by Lionel Landwerlin
Modified: 2011-03-07 20:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Lionel Landwerlin 2011-03-03 11:41:02 UTC
Hi,

I'm reproducing that crash quite easily, after having play 2/3 video files :

Program received signal SIGSEGV, Segmentation fault.

Thread 140736718681856 (LWP 29344)

  • #0 g_type_check_instance_is_a
    at gtype.c line 3941
  • #1 g_object_set
    at gobject.c line 1796
  • #2 update_av_offset
    at gstplaysink.c line 2705
  • #3 gst_play_sink_reconfigure
    at gstplaysink.c line 2572
  • #4 no_more_pads_cb
    at gstplaybin2.c line 2767
  • #5 g_closure_invoke
    at gclosure.c line 766
  • #6 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #7 g_signal_emit_valist
    at gsignal.c line 2983
  • #8 g_signal_emit
    at gsignal.c line 3040
  • #9 g_closure_invoke
    at gclosure.c line 766
  • #10 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #11 g_signal_emit_valist
    at gsignal.c line 2983
  • #12 g_signal_emit
    at gsignal.c line 3040
  • #13 gst_decode_bin_expose
    at gstdecodebin2.c line 3207
  • #14 source_pad_blocked_cb
    at gstdecodebin2.c line 3326
  • #15 handle_pad_block
    at gstpad.c line 4034
  • #16 gst_pad_push_event
    at gstpad.c line 5189
  • #17 gst_ffmpegdec_sink_event
    at gstffmpegdec.c line 2460
  • #18 gst_pad_send_event
    at gstpad.c line 5365
  • #19 gst_pad_push_event
    at gstpad.c line 5217
  • #20 gst_single_queue_push_one
    at gstmultiqueue.c line 944
  • #21 gst_multi_queue_loop
    at gstmultiqueue.c line 1101
  • #22 gst_task_func
    at gsttask.c line 318
  • #23 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #24 g_thread_create_proxy
    at gthread.c line 1897
  • #25 start_thread
    at pthread_create.c line 300
  • #26 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #27 ??

Here my packages versions on Debian (quite close from upstream) :

ii  gstreamer0.10-ffmpeg                 0.10.11-4                         FFmpeg plugin for GStreamer
ii  gstreamer0.10-plugins-bad            0.10.21-1                         GStreamer plugins from the "bad" set
ii  gstreamer0.10-plugins-base           0.10.32-1                         GStreamer plugins from the "base" set
ii  gstreamer0.10-plugins-good           0.10.27-1                         GStreamer plugins from the "good" set
ii  gstreamer0.10-plugins-ugly           0.10.17-1                         GStreamer plugins from the "ugly" set
ii  libgstreamer0.10-0                   0.10.32-4                         Core GStreamer libraries and elements
ii  libgstreamer-plugins-base0.10-0      0.10.32-1                         GStreamer libraries from the "base" set
Comment 1 Sebastian Dröge (slomo) 2011-03-03 14:28:19 UTC
Does this happen for specific video files, special codecs or anything? Could you get a valgrind log of this crash (don't forget to set the G_SLICE environment variable G_SLICE=malloc).
Comment 2 Sebastian Dröge (slomo) 2011-03-03 14:28:35 UTC
And use --track-origins=yes when using valgrind.
Comment 3 Lionel Landwerlin 2011-03-03 14:55:52 UTC
I'm using some demotivational videos from koreus.com, mostly .mp4 contained streams :

$ file ~/Videos/*.mp4
~/Videos/caniches-betise.mp4:                            ISO Media, MPEG v4 system, version 2
~/Videos/chat-laser-bowling.mp4:                         ISO Media, MPEG v4 system, version 2
~/Videos/descente-vtt-valparaiso.mp4:                    ISO Media, MPEG v4 system, version 2
~/Videos/farm-wars.mp4:                                  ISO Media, MPEG v4 system, version 2
Comment 4 Lionel Landwerlin 2011-03-03 16:04:00 UTC
Actually running valgrind on my application slows it so bad, that I can't get to the point were I reproduce the problem...
Comment 5 Lionel Landwerlin 2011-03-03 16:10:23 UTC
After ~2h running the application, some more evidences:

==22905== Thread 9:
==22905== Invalid read of size 8
==22905==    at 0x9945A47: g_object_set (gobject.c:1796)
==22905==    by 0x16D7E564: update_av_offset (gstplaysink.c:2705)
==22905==    by 0x16D82C78: gst_play_sink_reconfigure (gstplaysink.c:2572)
==22905==    by 0x16D77B80: no_more_pads_cb (gstplaybin2.c:2767)
==22905==    by 0x993EDFD: g_closure_invoke (gclosure.c:766)
==22905==    by 0x99571A6: signal_emit_unlocked_R (gsignal.c:3252)
==22905==    by 0x9958825: g_signal_emit_valist (gsignal.c:2983)
==22905==    by 0x9958D72: g_signal_emit (gsignal.c:3040)
==22905==    by 0x993EDFD: g_closure_invoke (gclosure.c:766)
==22905==    by 0x99571A6: signal_emit_unlocked_R (gsignal.c:3252)
==22905==    by 0x9958825: g_signal_emit_valist (gsignal.c:2983)
==22905==    by 0x9958D72: g_signal_emit (gsignal.c:3040)
==22905==  Address 0x159e1a80 is 0 bytes inside a block of size 1,328 free'd
==22905==    at 0x4C240FD: free (vg_replace_malloc.c:366)
==22905==    by 0x9962AFB: g_type_free_instance (gtype.c:1932)
==22905==    by 0x598D3AB: gst_message_finalize (gstmessage.c:196)
==22905==    by 0x598DA70: gst_mini_object_unref (gstminiobject.c:338)
==22905==    by 0x596DA37: gst_bus_set_flushing (gstmessage.h:323)
==22905==    by 0x599BBAC: gst_pipeline_change_state (gstpipeline.c:518)
==22905==    by 0x16D7B671: gst_play_bin_change_state (gstplaybin2.c:3542)
==22905==    by 0x597926B: gst_element_change_state (gstelement.c:2651)
==22905==    by 0x59792EE: gst_element_change_state (gstelement.c:2688)
==22905==    by 0x597C2FA: gst_element_set_state_func (gstelement.c:2607)
==22905==    by 0x52EED99: clutter_gst_video_texture_set_property (clutter-gst-video-texture.c:383)
==22905==    by 0x9945401: g_object_set_valist (gobject.c:1178)
==22905== 
==22905== Invalid read of size 8
==22905==    at 0x995BF87: g_type_check_instance_is_a (gtype.c:3936)
==22905==    by 0x9945A61: g_object_set (gobject.c:1796)
==22905==    by 0x16D7E564: update_av_offset (gstplaysink.c:2705)
==22905==    by 0x16D82C78: gst_play_sink_reconfigure (gstplaysink.c:2572)
==22905==    by 0x16D77B80: no_more_pads_cb (gstplaybin2.c:2767)
==22905==    by 0x993EDFD: g_closure_invoke (gclosure.c:766)
==22905==    by 0x99571A6: signal_emit_unlocked_R (gsignal.c:3252)
==22905==    by 0x9958825: g_signal_emit_valist (gsignal.c:2983)
==22905==    by 0x9958D72: g_signal_emit (gsignal.c:3040)
==22905==    by 0x993EDFD: g_closure_invoke (gclosure.c:766)
==22905==    by 0x99571A6: signal_emit_unlocked_R (gsignal.c:3252)
==22905==    by 0x9958825: g_signal_emit_valist (gsignal.c:2983)
==22905==  Address 0x159e1a80 is 0 bytes inside a block of size 1,328 free'd
==22905==    at 0x4C240FD: free (vg_replace_malloc.c:366)
==22905==    by 0x9962AFB: g_type_free_instance (gtype.c:1932)
==22905==    by 0x598D3AB: gst_message_finalize (gstmessage.c:196)
==22905==    by 0x598DA70: gst_mini_object_unref (gstminiobject.c:338)
==22905==    by 0x596DA37: gst_bus_set_flushing (gstmessage.h:323)
==22905==    by 0x599BBAC: gst_pipeline_change_state (gstpipeline.c:518)
==22905==    by 0x16D7B671: gst_play_bin_change_state (gstplaybin2.c:3542)
==22905==    by 0x597926B: gst_element_change_state (gstelement.c:2651)
==22905==    by 0x59792EE: gst_element_change_state (gstelement.c:2688)
==22905==    by 0x597C2FA: gst_element_set_state_func (gstelement.c:2607)
==22905==    by 0x52EED99: clutter_gst_video_texture_set_property (clutter-gst-video-texture.c:383)
==22905==    by 0x9945401: g_object_set_valist (gobject.c:1178)
==22905==
Comment 6 Sebastian Dröge (slomo) 2011-03-03 16:38:59 UTC
Ok, thanks. That's quite useful
Comment 7 Sebastian Dröge (slomo) 2011-03-05 09:50:58 UTC
So for some reason the ts_offset elements for the audio and video chain are not valid anymore and their last reference was dropped by some message.

Are you using any special sinks for audio and/or video here?
Comment 8 Lionel Landwerlin 2011-03-05 10:33:50 UTC
We construct the pipeline with playbin2 and use the ClutterGstVideoSink  (http://git.clutter-project.org/clutter-gst) and no particular audio sink.
Comment 9 Sebastian Dröge (slomo) 2011-03-05 10:45:47 UTC
Thanks, and this does happen when playing the first file and not only when switching from one file to another, right?
Comment 10 Lionel Landwerlin 2011-03-05 10:53:20 UTC
Indeed that happens when we switch from one video to another.
We have a background video in our UI (kind of animated background) and when we play a video, we stop the background video and switch to media we want to play.

I'm pretty sure we use 2 different ClutterGstVideoSink, but I need to check.
Comment 11 Lionel Landwerlin 2011-03-05 11:00:31 UTC
Actually we use the same pipeline, and when switching from one video to another we just :
 1. save the current state of the pipeline
 2. set the pipeline state to NULL
 3. change the uri
 4. set back the pipeline to the saved state

all of this in the same function.
Comment 12 Sebastian Dröge (slomo) 2011-03-05 11:02:00 UTC
Unfortunately I'm unable to reproduce it here (do you have a small sample application for reproducing it?) but I guess the problem will be quite obvious when looking closer at the code.
Comment 13 Sebastian Dröge (slomo) 2011-03-05 11:03:48 UTC
Oh this is likely fixed by the fix for bug #642466:

commit 19052a847d43c489e6bfd249d4e63ba31e630fe1
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Wed Feb 23 14:31:13 2011 +0100

    playsink: release all chains when going to NULL
    
    Also fixes #642466.


Can you confirm this?
Comment 14 Lionel Landwerlin 2011-03-05 11:04:27 UTC
A piece of code is worth a description :

http://git.clutter-project.org/clutter-gst/tree/clutter-gst/clutter-gst-video-texture.c#n331
Comment 15 Lionel Landwerlin 2011-03-05 11:16:32 UTC
Sounds like my problem :)

I confirm that the test case of #642466 leads to increasing the ref each time the state changes.
Give me some time rebuild the gstreamer package.
Comment 16 Lionel Landwerlin 2011-03-06 18:44:08 UTC
Ok, I recompiled the whole Gst stack with the last git versions and the problem is fixed.

Thank you very much !

*** This bug has been marked as a duplicate of bug 642466 ***
Comment 17 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-07 20:25:22 UTC
(In reply to comment #11)
> Actually we use the same pipeline, and when switching from one video to another
> we just :
>  1. save the current state of the pipeline
>  2. set the pipeline state to NULL
>  3. change the uri
>  4. set back the pipeline to the saved state
> 
> all of this in the same function.

FYI, GST_STATE_READY is sufficient to change the uri and would result in a quicker change over.
Comment 18 Lionel Landwerlin 2011-03-07 20:34:57 UTC
Is that true when the file is different ? Switch from a divx file to an mkv ?
Comment 19 Sebastian Dröge (slomo) 2011-03-07 20:49:26 UTC
(In reply to comment #18)
> Is that true when the file is different ? Switch from a divx file to an mkv ?

Yes