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 754395 - rtsp-media: prepare continues after error
rtsp-media: prepare continues after error
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-01 13:47 UTC by David Svensson Fors
Modified: 2018-11-03 15:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
media: state handling updates (6.58 KB, patch)
2015-09-01 13:49 UTC, David Svensson Fors
none Details | Review

Description David Svensson Fors 2015-09-01 13:47:14 UTC
I've encountered the following problem with GstRTSPMedia:

gst_rtsp_media_prepare() got an error in wait_preroll() and jumped to preroll_failed(). The media status had been set to GST_RTSP_MEDIA_STATUS_ERROR. gst_rtsp_media_prepare() called gst_rtsp_media_unprepare() and started unpreparing.

At the same time, start_prepare() was running in another thread. It had been scheduled by default_prepare(), which had been called by gst_rtsp_media_prepare() before wait_preroll(). start_prepare() called start_preroll(), which continued to set the media pipeline to PLAYING, despite the error in the other thread.

When the pipeline tried to go to READY, a gstmultiudpsink called getsockopt on a socket that had already been closed (as a result of the unprepare in the other thread).

The following two excerpts of gdb backtraces show the problem (gst-rtsp-server 1.4.3):

Thread 2:

...
  • #11 finish_unprepare
    at rtsp-media.c line 2420
  • #12 gst_rtsp_media_unprepare
    at rtsp-media.c line 2529
  • #13 gst_rtsp_media_prepare
    at rtsp-media.c line 2391
  • #14 find_media
    at rtsp-client.c line 625
  • #15 handle_describe_request
    at rtsp-client.c line 2076
  • #16 handle_request
    at rtsp-client.c line 2412
  • #17 gst_rtsp_client_handle_message
    at rtsp-client.c line 2978
  • #18 gst_rtsp_source_dispatch_read
    at gstrtspconnection.c line 3279
  • #1 getsockopt
    at monolith/src/main.c line 155
  • #2 gst_multiudpsink_start
    at gstmultiudpsink.c line 1365
  • #3 gst_base_sink_change_state
    at gstbasesink.c line 4901
  • #4 gst_element_change_state
    at gstelement.c line 2602
  • #5 gst_element_set_state_func
    at gstelement.c line 2558
  • #6 gst_bin_element_set_state
    at gstbin.c line 2328
  • #7 gst_bin_change_state_func
    at gstbin.c line 2665
  • #8 gst_element_change_state
    at gstelement.c line 2602
  • #9 gst_element_set_state_func
    at gstelement.c line 2558
  • #10 start_preroll
    at rtsp-media.c line 2100
  • #11 start_prepare
    at rtsp-media.c line 2179
  • #12 g_main_dispatch
    at gmain.c line 3064

Comment 1 David Svensson Fors 2015-09-01 13:49:54 UTC
Created attachment 310419 [details] [review]
media: state handling updates

The attached suggested patch contains a fix for the problem (checking media status before calling set_state() in start_preroll()) and some other fixes concering the state lock in GstRTSPMedia:

* Check state errors in more places (protecting against concurrent
  updates).
* Protect set_state with state lock (except in finish_unprepare, where
  a comment explains that we release the lock for avoiding deadlocks).
* Consistently do convert_range with state lock held (as it says in
  the comment for default_convert_range).
* Clarify that default_prepare and default_setup_sdp are called with
  state lock.
Comment 2 GStreamer system administrator 2018-11-03 15:38:54 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/gst-rtsp-server/issues/13.