Galicaster icon indicating copy to clipboard operation
Galicaster copied to clipboard

Galicaster does not free resources correctly after a recording

Open rubenrua opened this issue 13 years ago • 6 comments

We have noticed this after discovering that the number of file descriptors open by Galicaster (in /proc/PID/fd) steadily grows with each recording.

rubenrua avatar Feb 27 '13 11:02 rubenrua

The underlying problem is that some resources open by the recording pipeline are never freed. For instance, sockets created by alsasink stay there after the pipeline is closed. This behaviour cannot be reproduced in C, only using python. In [1] you can see the full code used in the tests.

After studying the problem, we have found the bug is in gst.parse_bin_from_description(). Examples:

Does not properly free its resources:

self.pipeline = gst.Pipeline()
aux = "audiotestsrc ! alsasink" 
self.bin = gst.parse_bin_from_description(aux, False)
self.pipeline.add(self.bin)  

Frees resources properly:

self.pipeline = gst.Pipeline()
src = gst.element_factory_make('audiotestsrc')
sink = gst.element_factory_make('alsasink')   
mbin = gst.Bin()                              
mbin.add(src, sink)        
self.pipeline.add(mbin)    
src.link(sink)

Frees resources properly:

self.pipeline = gst.Pipeline()
aux = "(audiotestsrc ! alsasink)" 
self.bin = gst.parse_launch(aux)  
self.pipeline.add(self.bin)

We are using the last example as a workaround -- using gst.parse_launch and surrounding the description with brackets "()".

[1] https://gist.github.com/rubenrua/5046986

rubenrua avatar Feb 27 '13 11:02 rubenrua

I reopen the issue because the problem is not fixed if you use a Blackmagic card.

See Christian Greweling email

rubenrua avatar May 15 '14 14:05 rubenrua

The bug is not the same. Because it can be reproduced in C language [2]. I create a new issue #99

[2] https://gist.github.com/rubenrua/dde3276a341494b75115

rubenrua avatar May 15 '14 15:05 rubenrua

I am reopening this.

In GStreamer 1.0 we are always having this issue. Testing the python snippets above, all of them have this issue now. Also, the C script [2] does not fail either. We believe it has to do with the python bindings of GStreamer, and we have opened a bug [3] on bugzilla on the GStreamer tracker.

[2] https://gist.github.com/rubenrua/dde3276a341494b75115 [3] https://bugzilla.gnome.org/show_bug.cgi?id=782553

Alfro avatar May 29 '17 14:05 Alfro

We believe this is causing #387 Edit: It's not. See below:

Alfro avatar May 29 '17 14:05 Alfro

We have confirmed this issue does not cause #387

With the help of the GStreamer people, this issue was solved for the GStreamer master branch. In the task we opened, they confirmed the change fixing this would not be backported to the 1.12 release and earlier: https://bugzilla.gnome.org/show_bug.cgi?id=782553

Having this into account, we patched the gstreamer package (gir1.2-gstreamer-1.0) for the 1.8 version and uploaded the .deb to the galicaster repository. When we deal with #531 we may have to create a package for the 1.10 version as well.

Alfro avatar Jun 19 '17 14:06 Alfro