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 744209 - rtspsrc: May stop sending keep alive due to buggy timeout in rtspconnection
rtspsrc: May stop sending keep alive due to buggy timeout in rtspconnection
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.4.5
Other Mac OS
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-10 03:24 UTC by lockandfire
Modified: 2018-11-03 14:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtspconnection: Fix timeout handling (4.40 KB, patch)
2015-03-26 17:08 UTC, Nicolas Dufresne (ndufresne)
reviewed Details | Review
rtspsrc: Remove uneeded keep-alive hack (1.53 KB, patch)
2015-03-26 17:09 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
rtspconnection: Fix timeout handling (8.15 KB, patch)
2015-03-26 20:39 UTC, Nicolas Dufresne (ndufresne)
needs-work Details | Review

Description lockandfire 2015-02-10 03:24:49 UTC
In 1.2.x, rtspsrc is sending out GET_PARAMETER every 75seconds, however , in 1.4.5/1.4.4, after the first GET_PARAMETER is sent out, there is no the second one.

Tested on win7 and mac os x

related post: http://gstreamer-devel.966125.n4.nabble.com/GStreamer-neither-keep-rtsp-alive-nor-re-connect-to-ip-camera-td4670632.html
Comment 1 Tim-Philipp Müller 2015-03-26 12:48:53 UTC
This seems to work fine for me (in Linux anyway), it sends a GET_PARAMETER every 55 seconds, both in 1.4.4 and git master:

RTSP request message 0x7f6395345ca0
 request line:
   method: 'PLAY'
   uri:    'rtsp://127.0.0.1:8554/test/'
   version: '1.0'
 headers:
   key: 'Range', value: 'npt=0-'
 body:
Progress: (request) Sending PLAY request
RTSP response message 0x7f6395345d00
 status line:
   code:   '200'
   reason: 'OK'
   version: '1.0'
 headers:
   key: 'CSeq', value: '5'
   key: 'RTP-Info', value: 'url=rtsp://127.0.0.1:8554/test/stream=0;seq=8991;rtptime=2681263360'
   key: 'RTP-Info', value: 'url=rtsp://127.0.0.1:8554/test/stream=1;seq=11700;rtptime=2704522221'
   key: 'Range', value: 'npt=0-6575.574'
   key: 'Server', value: 'GStreamer RTSP server'
   key: 'Session', value: 'Pg5cn1lher+rVkXy'
   key: 'Date', value: 'Thu, 26 Mar 2015 12:43:06 GMT'
 body: length 0
Progress: (request) Sent PLAY request
Redistribute latency...
RTSP request message 0x7f6395345d30
 request line:
   method: 'GET_PARAMETER'
   uri:    'rtsp://127.0.0.1:8554/test/'
   version: '1.0'
 headers:
 body:
RTSP response message 0x7f6395345e00
 status line:
   code:   '200'
   reason: 'OK'
   version: '1.0'
 headers:
   key: 'CSeq', value: '6'
   key: 'Server', value: 'GStreamer RTSP server'
   key: 'Date', value: 'Thu, 26 Mar 2015 12:44:01 GMT'
 body: length 0
RTSP request message 0x7f6395345d30
 request line:
   method: 'GET_PARAMETER'
   uri:    'rtsp://127.0.0.1:8554/test/'
   version: '1.0'
 headers:
 body:
RTSP response message 0x7f6395345e00
 status line:
   code:   '200'
   reason: 'OK'
   version: '1.0'
 headers:
   key: 'CSeq', value: '7'
   key: 'Server', value: 'GStreamer RTSP server'
   key: 'Date', value: 'Thu, 26 Mar 2015 12:44:56 GMT'
 body: length 0

Could you provide a GST_DEBUG=*rtsp*:6 debug log?
Comment 2 Nicolas Dufresne (ndufresne) 2015-03-26 17:08:05 UTC
Created attachment 300370 [details] [review]
rtspconnection: Fix timeout handling

When dealing with GTimeVal, if we have one but value is 0 0 we should
timeout right way. In many places we would block forever instead. As
an opposite, some other case would never block (using
g_cond_wait_until() passing time now will return right way). This
should fix rare case of RTSP keep-alive not being sent anymore.
Comment 3 Nicolas Dufresne (ndufresne) 2015-03-26 17:09:35 UTC
Created attachment 300371 [details] [review]
rtspsrc: Remove uneeded keep-alive hack

The rtsp connection code has been fixed now.
Comment 4 Nicolas Dufresne (ndufresne) 2015-03-26 17:12:41 UTC
This explain why keep alive may stop being sent in UDP, but does not explain why 1.2 was less likely to hit this issue then 1.4 though.
Comment 5 Tim-Philipp Müller 2015-03-26 17:23:28 UTC
Comment on attachment 300370 [details] [review]
rtspconnection: Fix timeout handling

>+    /* Timeout period have expired already */
>+    if (to == 0)
>+      return GST_RTSP_ETIMEOUT;
>+  }
>+
>   g_socket_client_set_timeout (conn->client,
>       (to + GST_SECOND - 1) / GST_SECOND);

Hrm, it's not clear to me that this is correct, if it should really not even attempt to read any data here. That would be a bit like changing gst_bus_timed_pop() to always return NULL if timeout is 0 even if there's a pending message, no?
Comment 6 Nicolas Dufresne (ndufresne) 2015-03-26 17:51:31 UTC
Ok, let's be honest, the entire timeout API is broken here. Socket timeout is per operation, it won't help hitting a deadline.
Comment 7 Nicolas Dufresne (ndufresne) 2015-03-26 20:39:58 UTC
Created attachment 300392 [details] [review]
rtspconnection: Fix timeout handling

When dealing with GTimeVal, if we have one but value is 0 0 we should
timeout right way. In many places we would block forever instead. As
an opposite, some other case would never block (using
g_cond_wait_until() passing time now will return right way). This
should fix rare case of RTSP keep-alive not being sent anymore.
Comment 8 Sebastian Dröge (slomo) 2015-04-26 18:57:19 UTC
Nicolas, what's the status of this? All broken beyond repair or is your latest patch fixing it? :)
Comment 9 Nicolas Dufresne (ndufresne) 2015-04-26 21:04:46 UTC
It's a good question. I don't have a test to actually reproduce the issue, I only have an good understanding of why it will constantly stop working from reading the code. The design of the timeout is flawed to start with, but I would probably not say beyond repair. I think the patch should improve the situation slightly, but more testing is required.

My general impression is that in the long term we should entirely deprecate these read/write method and implement proper async() GIO methods. GTask solves a lot of the issues we are facing now and would greatly improve scalability. Right now the code is doing very little multiplexing, and won't scale with a large group of connections.
Comment 10 Nicolas Dufresne (ndufresne) 2015-06-22 19:39:52 UTC
Review of attachment 300392 [details] [review]:

::: gst-libs/gst/rtsp/gstrtspconnection.c
@@ +802,3 @@
+    } else {
+      GST_ERROR ("failed to connect: %s", error->message);
+      res = GST_RTSP_ETIMEOUT;

Should probably be a generic error, not a timeout in that second case.

@@ +912,3 @@
+    } else {
+      GST_ERROR ("failed to connect: %s", error->message);
+      res = GST_RTSP_ETIMEOUT;

Same here.
Comment 11 caiortp 2017-03-10 19:14:25 UTC
I'm having the similar problem when I connect to a RTSP Server with TLS.
When I configure the RTSP Server to TCP only there's no problem with keep_alive.

Gst Version 1.4.1 kernel 3.10.17 arch=armv7 (imx6)


GST_DEBUG=3 log.

gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtpmanager/rtpjitterbuffer.c:185:rtp_jitter_buffer_set_clock_rate: Clock rate changed from 0 to 90000
[  322.203400] mxc_sdc_fb fb.20: MXCFB_WAIT_FOR_VSYNC: timeout 0
Jan 01 00:09:52 colibri-imx6 run_graphics.sh[523]: onRtpBinPadAdded:  "video"  linked
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.680961044   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:4364:gst_rtspsrc_send_keep_alive:<rtspsrc0> warning: Could not send keep-alive. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.681279377   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:4710:gst_rtspsrc_loop_udp:<rtspsrc0> warning: Unhandled return value -7.
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.681428377   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:4781:gst_rtspsrc_loop_udp:<rtspsrc0> error: Could not receive message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.684107711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5067:gst_rtspsrc_loop:<rtspsrc0> error: Internal data flow error.
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.684153711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5067:gst_rtspsrc_loop:<rtspsrc0> error: streaming task paused, reason error (-5)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725066711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5446:gst_rtspsrc_try_send:<rtspsrc0> error: Could not send message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725234377   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:7585:gst_rtspsrc_pause:<rtspsrc0> error: Could not send message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725411044   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:4710:gst_rtspsrc_loop_udp:<rtspsrc0> warning: Unhandled return value -7.
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725553711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:4781:gst_rtspsrc_loop_udp:<rtspsrc0> error: Could not receive message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725662044   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5067:gst_rtspsrc_loop:<rtspsrc0> error: Internal data flow error.
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.725699044   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5067:gst_rtspsrc_loop:<rtspsrc0> error: streaming task paused, reason error (-5)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.739512711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:5446:gst_rtspsrc_try_send:<rtspsrc0> error: Could not send message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: 0:06:05.740400711   525   0xfb4e30 WARN                 rtspsrc /home/caio/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/gst/rtsp/gstrtspsrc.c:7057:gst_rtspsrc_close:<rtspsrc0> error: Could not send message. (System error)
Jan 01 00:10:45 colibri-imx6 run_graphics.sh[523]: STATE NULL PIPELINE ERROR!!!
Comment 12 GStreamer system administrator 2018-11-03 14:57:48 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-plugins-good/issues/159.