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 643577 - gst-rtsp-server: g_object_ref: assertion `G_IS_OBJECT (object)' failed
gst-rtsp-server: g_object_ref: assertion `G_IS_OBJECT (object)' failed
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
0.10.8
Other Linux
: Normal blocker
: 0.10.9
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-03-01 11:25 UTC by Nicola
Modified: 2011-08-16 10:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GST_DEBUG_NO_COLOR=1 GST_DEBUG=rtsp*:5,v4l2src:5,pipeline:5 Debug Trace (746.17 KB, text/plain)
2011-07-28 13:22 UTC, Robert Krakora
  Details
Patch to destroy pipeline on client disconnect with no prior TEARDOWN. (703 bytes, patch)
2011-07-28 15:46 UTC, Robert Krakora
none Details | Review
Updated: Patch to destroy pipeline on client disconnect with no prior TEARDOWN. (793 bytes, patch)
2011-08-05 13:09 UTC, Robert Krakora
none Details | Review
Updated (: Patch to destroy pipeline on client disconnect with no prior TEARDOWN. (793 bytes, patch)
2011-08-05 13:12 UTC, Robert Krakora
none Details | Review

Description Nicola 2011-03-01 11:25:24 UTC
After some play/stop sequence I get this:

GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
aborting...

Program received signal SIGABRT, Aborted.

Thread 140737278793472 (LWP 11373)

  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 92
  • #2 g_logv
    from /lib/libglib-2.0.so.0
  • #3 g_log
    from /lib/libglib-2.0.so.0
  • #4 g_object_ref
    from /usr/lib/libgobject-2.0.so.0
  • #5 find_media
    at rtsp-media-mapping.c line 88
  • #6 find_media
    at rtsp-client.c line 321
  • #7 handle_describe_request
    at rtsp-client.c line 1138
  • #8 handle_request
    at rtsp-client.c line 1358
  • #9 message_received
    at rtsp-client.c line 1653
  • #10 gst_rtsp_source_dispatch
    at gstrtspconnection.c line 3179
  • #11 g_main_context_dispatch
    from /lib/libglib-2.0.so.0
  • #12 ??
    from /lib/libglib-2.0.so.0
  • #13 g_main_loop_run
    from /lib/libglib-2.0.so.0
  • #14 RtspThread::run
    at rtsp/rtspthread.cpp line 23
  • #15 QThreadPrivate::start
    at thread/qthread_unix.cpp line 248
  • #16 start_thread
    at pthread_create.c line 300
  • #17 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #18 ??

Comment 1 Nicola 2011-03-01 11:34:55 UTC
some additional infos:

I'm reproducing this error after 2/3 play/stop sequence with vlc (1.1.7) as rtsp client. The pipeline I'm using with gst-rtsp is the following:

souphttpsrc location=... ! queue ! matroskademux ! mpeg4videoparse ! rtpmp4vpay name=pay0 pt=96

If I not set export G_DEBUG=fatal_warnings the program will continue to run and I can access http stream with pipeline such the following:

souphttpsrc location=... ! queue ! matroskademux ! decodebin2 ! xvimagesink

but the rtsp stream (based on the http one) is unavailable
Comment 2 Nicola 2011-03-15 17:33:09 UTC
same test case another crash:

GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed

CRITICAL **: gst_rtsp_media_factory_get_auth: assertion `GST_IS_RTSP_MEDIA_FACTORY (factory)' failed

gdb) bt
  • #0 __pthread_mutex_lock
    at pthread_mutex_lock.c line 50
  • #1 gst_rtsp_media_factory_construct
    at rtsp-media-factory.c line 426
  • #2 find_media
    at rtsp-client.c line 336
  • #3 handle_describe_request
    at rtsp-client.c line 1138
  • #4 handle_request
    at rtsp-client.c line 1358
  • #5 message_received
    at rtsp-client.c line 1653
  • #6 gst_rtsp_source_dispatch
    at gstrtspconnection.c line 3179
  • #7 g_main_context_dispatch
    from /lib/libglib-2.0.so.0
  • #8 ??
    from /lib/libglib-2.0.so.0
  • #9 g_main_context_iteration
    from /lib/libglib-2.0.so.0
  • #10 QEventDispatcherGlib::processEvents
    at kernel/qeventdispatcher_glib.cpp line 412
  • #11 QEventLoop::processEvents
    at kernel/qeventloop.cpp line 149
  • #12 QEventLoop::exec
    at kernel/qeventloop.cpp line 201
  • #13 QCoreApplication::exec
    at kernel/qcoreapplication.cpp line 981
  • #14 main
    at main.cpp line 62

Comment 3 Nicola 2011-03-16 23:04:30 UTC
connecting/disconnecting to gst-rtsp cause a 100% cpu usage too. These problems are more evident if you have a slow network beetwen the rtsp server and the source stream, however sometimes happen even with source stream and rtsp server on the same LAN (less frequently)
Comment 4 Nicola 2011-04-01 19:27:11 UTC
forget the 100% cpu usage this is caused by gstpoll (https://bugzilla.gnome.org/show_bug.cgi?id=645746), I can confirm the other issues
Comment 5 Robert Krakora 2011-07-27 19:09:39 UTC
Hello,

I am experiencing the same problem.

GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed

CRITICAL **: gst_rtsp_media_factory_get_auth: assertion
`GST_IS_RTSP_MEDIA_FACTORY (factory)' failed

Rob Krakora
Comment 6 Tim-Philipp Müller 2011-07-27 19:18:01 UTC
> I am experiencing the same problem.
> 
> GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
> 
> CRITICAL **: gst_rtsp_media_factory_get_auth: assertion
> `GST_IS_RTSP_MEDIA_FACTORY (factory)' failed

Great, maybe you can help track it down and fix it :)
Comment 7 Robert Krakora 2011-07-27 19:34:30 UTC
If I set the "shared" property to "true" I don't see this assertion anymore...however, I fail to see the root cause of the bug with the "shared" property set to "false".
Comment 8 Robert Krakora 2011-07-27 19:39:46 UTC
Something to do with the "shared" property...as it's state gets set on the GstRTSPMedia param in the function below...

default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
{
  gboolean shared, eos_shutdown;
  guint size;
  GstRTSPAuth *auth;

  /* configure the sharedness */
  GST_RTSP_MEDIA_FACTORY_LOCK (factory);
  shared = factory->shared;
  eos_shutdown = factory->eos_shutdown;
  size = factory->buffer_size;
  GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);

  gst_rtsp_media_set_shared (media, shared);
  gst_rtsp_media_set_eos_shutdown (media, eos_shutdown);
  gst_rtsp_media_set_buffer_size (media, size);

  if ((auth = gst_rtsp_media_factory_get_auth (factory))) {
    gst_rtsp_media_set_auth (media, auth);
    g_object_unref (auth);
  }
}
Comment 9 Tim-Philipp Müller 2011-07-27 22:42:05 UTC
Could you try with latest git as of now? There was a refcounting fix which looks like it might be related (http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/commit/?id=aa128813fedf6075720275f672edf78039b5ad3f)
Comment 10 Robert Krakora 2011-07-28 12:57:19 UTC
Hi Tim,

I have tried with the latest Git and the problem persists.  However, I believe that this is just a symptom of another problem that may exist in v4l2src which is part of the pipeline that is passed to the server.  Seems like after a successful connection is torn down along with the pipeline and a new one created, that the parameters on the USB webcam cannot be get/set.  If I set "shared" to "true" then it seems that the pipeline is never torn down between connections and all is well.  This will need more investigation on my part as I have not see this behaviour with webcams other than these three new H.264 webcams (FaceVsion, Logitech and Creative).  It may even be a problem with v4l2 and not the v4l2src element.  I will keep you posted.

Best Regards,

Rob Krakora
Comment 11 Robert Krakora 2011-07-28 13:22:06 UTC
Created attachment 192817 [details]
GST_DEBUG_NO_COLOR=1 GST_DEBUG=rtsp*:5,v4l2src:5,pipeline:5 Debug Trace

Here is a trace of the problem...
Comment 12 Robert Krakora 2011-07-28 13:23:30 UTC
GST_DEBUG_NO_COLOR=1 GST_DEBUG=rtsp*:5,v4l2src:5 /home/silentm/Development/gst-rtsp-server/examples/.libs/test-launch "v4l2src device=/dev/video0 always-copy=false ! image/jpeg, width=1280, height=720, framerate=30/1 ! rtpjpegpay pt=26 name=pay0" &>problem.txt

FV TouchCam E1 webcam attached as V4L2 device.
Comment 13 Robert Krakora 2011-07-28 13:57:26 UTC
This bug appears to be related to https://bugzilla.gnome.org/show_bug.cgi?id=628640 as I see this message as indicated in 628640.

0:00:15.066838730  6775      0x1171490 WARN               rtspmedia rtsp-media.c:1500:default_handle_message: 0x121e8e0: got error Device '/dev/video0' cannot capture at 1280x720 (gstv4l2object.c(2111): gst_v4l2_object_set_format (): /GstPipeline:media-pipeline/GstPipeline:pipeline1/GstV4l2Src:v4l2src1:
Call to S_FMT failed for MJPG @ 1280x720: Device or resource busy)
Comment 14 Robert Krakora 2011-07-28 14:31:57 UTC
So, it looks like even though the first connection has been closed the pipeline associated with it never gets torn down and it is still in PLAY state and grabbing frames and thus has the v4l2 device.  The second connection comes in and the RTSP server builds another pipeline for it and the v4l2src element in this pipeline attempts to utilize the same v4l2 device in use by the other pipeline and this produces the "resource busy" message.  So, the pipeline instantiated by the first connection is never getting torn down, so it makes since that when I set the RTSP server property "shared" to "true" that this problem is not encountered since the pipeline instantiated by the first connection would always be present and shared by many clients.
Comment 15 Robert Krakora 2011-07-28 15:27:19 UTC
The problem occurs when the client abruptly closes the connection without
issuing a TEARDOWN.  The TEARDOWN handler in the rtsp-client.c file of the RTSP
server is where the pipeline gets torn down.  Since this handler is not called,
the pipeline remains and is up and running.  Subsequent clients get their own
pipelines and if the do not issue TEARDOWNs then those pipelines will also
remain up and running.  This is a resource leak in my opinion.  I have a patch
which I am testing and will be posting soon for your inspection and testing.
Comment 16 Robert Krakora 2011-07-28 15:46:23 UTC
Created attachment 192819 [details] [review]
Patch to destroy pipeline on client disconnect with no prior TEARDOWN.

Here is the patch...
Comment 17 Robert Krakora 2011-07-28 15:47:55 UTC
Let me know if there are alternate proposals to this proposed patch.  I don't know the RTSP server very well, the change in this patch made sense to me, but there may be a more elegant and sensible solution.
Comment 18 Robert Krakora 2011-08-03 18:02:08 UTC
(In reply to comment #6)
> > I am experiencing the same problem.
> > 
> > GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
> > 
> > CRITICAL **: gst_rtsp_media_factory_get_auth: assertion
> > `GST_IS_RTSP_MEDIA_FACTORY (factory)' failed
> 
> Great, maybe you can help track it down and fix it :)

Hi Tim,

When you get a chance, would you review my patch for this bug.  Thanks in advance.

Best Regards,

Rob Krakora
Comment 19 Robert Krakora 2011-08-05 13:08:18 UTC
Comment on attachment 192819 [details] [review]
Patch to destroy pipeline on client disconnect with no prior TEARDOWN.

--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-client.c	2011-08-05 07:48:26.742988486 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-client.c	2011-08-04 16:48:18.109986945 -0400
@@ -121,8 +121,10 @@
 
   /* unlink all media managed in this session */
   for (medias = session->medias; medias; medias = g_list_next (medias)) {
-    unlink_session_streams (client, session,
-        (GstRTSPSessionMedia *) medias->data);
+    gst_rtsp_session_media_set_state ((GstRTSPSessionMedia *) medias->data, GST_STATE_NULL);
+    unlink_session_streams (client, session, (GstRTSPSessionMedia *) medias->data);
+    /* unmanage the media in the session. */
+    gst_rtsp_session_release_media (session, (GstRTSPSessionMedia *) medias->data);
   }
 }
Comment 20 Robert Krakora 2011-08-05 13:09:59 UTC
Created attachment 193306 [details] [review]
Updated: Patch to destroy pipeline on client disconnect with no prior TEARDOWN.

Updated the patch...two function calls were reversed...
Comment 21 Robert Krakora 2011-08-05 13:12:57 UTC
Created attachment 193307 [details] [review]
Updated (: Patch to destroy pipeline on client disconnect with no prior TEARDOWN.

Forgot to obsolete prior patches on last update...same as last updated patch...
Comment 22 Wim Taymans 2011-08-16 10:13:02 UTC
Thanks!

commit f7223cfdab653409cd92d117c906de166b00623b
Author: Robert Krakora <rob.krakora at messagenetsystems.com>
Date:   Tue Aug 16 12:09:48 2011 +0200

    client: destroy pipeline on client disconnect with no prior TEARDOWN.
    
    The problem occurs when the client abruptly closes the connection without
    issuing a TEARDOWN.  The TEARDOWN handler in the rtsp-client.c file of the RTSP
    server is where the pipeline gets torn down.  Since this handler is not called,
    the pipeline remains and is up and running.  Subsequent clients get their own
    pipelines and if the do not issue TEARDOWNs then those pipelines will also
    remain up and running.  This is a resource leak.