Gstreamer opened files leek.

Krutskikh Ivan stein.hak at gmail.com
Fri Sep 30 13:19:12 UTC 2016


Hi everyone.

I'm developing a video storage and streaming server for ip cameras based on
gstreamer and python. It's multithreaded daemon which launches 2 threads
for each cam ( recorder and streamer). Recently I found out that upon EOS
or error gstreamer pipepeline leaves some orphaned opened sockets in the
system. This is very painfull because I have to run 30-50 cams per server
24/7. I already raised all limits to maximum on my linux setup, but other
libraries like asyncore are failing when opened file count > 1024.I tried
changing my pipeline to the most simple one, but the problem persist. Maybe
I fail to release the pipeline correctly? Here's the sample code

http://pastebin.com/isk6KsA9

I blame the kill() function:

   def kill(self):
    if self.pipeline:
           self.sink.emit('clear')
           self.bus.remove_signal_watch()

           self.pipeline.set_state(Gst.State.NULL)
           state = self.pipeline.get_state(timeout=1*Gst.SECOND)
           while state[1] != Gst.State.NULL:
            self.remove_all()
            state = self.pipeline.get_state(timeout=1*Gst.SECOND)


        if self.ping_test(self.host) == 0:
            self.state = -2
            else:
            self.state = -1

            self.timestamp = None

        self.mainloop.quit()

    elif self.mainloop.is_running():
        self.mainloop.quit()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160930/44ec8aeb/attachment.html>


More information about the gstreamer-devel mailing list