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 759777 - Add "max-clients" property to limit number of connecting clients in GstRTSPServer
Add "max-clients" property to limit number of connecting clients in GstRTSPSe...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-22 14:50 UTC by Sebastian Rasmussen
Modified: 2018-11-03 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (7.83 KB, patch)
2015-12-22 14:59 UTC, Sebastian Rasmussen
none Details | Review
Proposed patch. (7.83 KB, patch)
2016-02-10 10:06 UTC, Sebastian Rasmussen
none Details | Review

Description Sebastian Rasmussen 2015-12-22 14:50:06 UTC
GstRTSPServer currently has a way of limiting the number of work being done in parallel by setting the maximum number of threads on the GstRTSPThreadPool being used. But there is no way to limit the number of connecting clients (some of which may later be accepted, and some be denied e.g. by the ->prepare() virtual function denying access). If there is no limit then some resource may be depleted, e.g. the number of file descriptors that may be open in the process running GstRTSPServer.

The proposed patch adds a property on GstRTSPServer exposing a max-clients limit. Once this limit has been reached the server will simply disconnect any connecting client without letting it send its request and without sending any RTSP response.

I'm of course available for further discussions concerning this patch.
Comment 1 Sebastian Rasmussen 2015-12-22 14:59:16 UTC
Created attachment 317788 [details] [review]
Proposed patch.
Comment 2 Tim-Philipp Müller 2015-12-22 15:03:42 UTC
FWIW, you can already limit the number of clients by implementing GstRTSPServer::create_client() and returning NULL from there if the max number of clients is reached.
Comment 3 Sebastian Rasmussen 2015-12-22 16:20:57 UTC
That's indeed true. Do you prefer that rate limiting is kept outside of gst-rtsp-server and then implemented by each project as it sees fit? Perhaps there are other ways that projects would like to decide whether a client should be denied? Can't think of any of the bat though.
Comment 4 Olivier Crête 2016-01-12 18:26:13 UTC
I like the idea of having a generic max-clients, but I'd like better to return a meaningful error. Maybe set it to reject DESCRIBE/PLAY requests with a "453 Not Enough Bandwidth" and an explanatory message. It will make users life easier when their cameras start rejecting clients for no clear reason!
Comment 5 Sebastian Rasmussen 2016-01-12 18:29:11 UTC
Actually when you have even more clients than your hardware can handle you can't even bother to read the request and responde with a 453 or a 503 because doing so would consume more of those precious resources that you don't have enough of. Also 453 seems to be related to bandwidth reservation which is not really what I'm trying to get at here. The scenario is a pure denial of service attack using RTSP-clients that basically attempt to do DESCRIBE and then disconnect.
Comment 6 Anders Jonsson 2016-02-10 06:57:55 UTC
Comment on attachment 317788 [details] [review]
Proposed patch.

+   * The maximum number of connected clients that the server can handle. If
+   * this number of exceeded the server will being to close connections to
+   * connecting clients as a means of rate limiting the number of clients.

The second sentence was hard to parse for me. Is it "If this number is exceeded the server will begin to close connections" that is intended?
Comment 7 Sebastian Rasmussen 2016-02-10 10:06:49 UTC
Created attachment 320776 [details] [review]
Proposed patch.
Comment 8 Sebastian Rasmussen 2016-02-10 10:18:02 UTC
Anders, thanks for checking not my Swedish translations for other projects, but also my code comments here! I wasn't really expecting this. :)
Comment 9 GStreamer system administrator 2018-11-03 15:39:27 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/17.