<div dir="ltr">Hi Tim,<div><br></div><div style>This issue can be duplicated in one of my test case, which can be launched by in the project <a href="https://github.com/duzy/gst-switch">https://github.com/duzy/gst-switch</a>:</div>
<div style><br></div><div style> $ make test-composite-mode</div><div style><br></div><div style>Or:</div><div style><br></div><div style> $ make TESTARGS="--print-debug-messages" test-composite-mode</div>
<div style><br></div><div style>Or (this will produce tests/test-switch-server-valgrind.log):</div><div style><br></div><div style> $ make TESTARGS="--valgrind" test-composite-mode</div><div style><br></div>
<div style>
The "test-composite-mode" repeatedly send request to the gst-switch-server which will cause the server indirectly recreate the pipelines.</div><div style><br></div><div style>Duzy</div><div style><br></div><div style>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 6, 2013 at 5:42 PM, Tim-Philipp Müller <span dir="ltr"><<a href="mailto:t.i.m@zen.co.uk" target="_blank">t.i.m@zen.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 2013-02-06 at 10:01 +0800, Duzy Chan wrote:<br>
<br>
Hi,<br>
<br>
have you tried making a minimal stand-alone test case for this?<br>
<br>
Cheers<br>
-Tim<br>
<div><div class="h5"><br>
> I'm using GStreamer for a AV switch app. Which will recreate the<br>
> pipelines looks like as following listing repeatedly:<br>
><br>
><br>
> intervideosrc name=source_a channel=composite_a<br>
> intervideosrc name=source_b channel=composite_b<br>
> videomixer name=compose<br>
> source_b. ! video/x-raw,width=100,height=56<br>
> ! queue2 ! compose.sink_1<br>
> source_a. ! video/x-raw,width=100,height=56<br>
> ! queue2 ! compose.sink_0<br>
> compose. ! video/x-raw,width=100,height=56<br>
> ! queue2 ! gdppay ! tcpserversink name=out port=3001<br>
><br>
> But it turns out there're socket file descriptors leaking until "Too<br>
> many open files" issued and be killed the app. The error looks like:<br>
><br>
><br>
> (gst-switch-srv:1709): GLib-ERROR **: Creating pipes for GWakeup: Too<br>
> many open files<br>
><br>
><br>
> And my code used to recreate the pipelines is gst_worker_reset which<br>
> is at<br>
> <a href="https://github.com/duzy/gst-switch/blob/master/tools/gstworker.c#L597" target="_blank">https://github.com/duzy/gst-switch/blob/master/tools/gstworker.c#L597</a> as it's looking like:<br>
><br>
><br>
><br>
> worker->pipeline = workerclass->create_pipeline (worker);<br>
><br>
><br>
> if (!worker->pipeline)<br>
><br>
><br>
> goto error_create_pipeline;<br>
><br>
><br>
><br>
><br>
> gst_pipeline_set_auto_flush_bus (GST_PIPELINE (worker->pipeline),<br>
> FALSE);<br>
><br>
><br>
><br>
><br>
> worker->bus = gst_pipeline_get_bus (GST_PIPELINE<br>
> (worker->pipeline));<br>
><br>
><br>
> if (!worker->bus)<br>
><br>
><br>
> goto error_get_bus;<br>
><br>
><br>
><br>
><br>
> worker->watch = gst_bus_add_watch (worker->bus,<br>
><br>
><br>
> (GstBusFunc) gst_worker_message, worker);<br>
><br>
><br>
> if (!worker->watch)<br>
><br>
><br>
> goto error_add_watch;<br>
><br>
><br>
><br>
><br>
> if (workerclass->prepare && !workerclass->prepare (worker))<br>
><br>
><br>
> goto error_prepare;<br>
><br>
><br>
><br>
><br>
> By hacking into tcpserversink, I found that the tcpserversink will<br>
> emit a client-socket-removed signal and requiring it's client code to<br>
> manually close the socket, and I've already done it by<br>
><br>
><br>
> g_signal_connect (sink, "client-socket-removed",<br>
><br>
><br>
> G_CALLBACK (output_client_socket_removed), w);<br>
><br>
><br>
> And:<br>
><br>
><br>
><br>
> static void<br>
><br>
><br>
> output_client_socket_removed (GstElement *element,<br>
><br>
><br>
> GSocket *socket, GstComposite *composite)<br>
><br>
><br>
> {<br>
> g_return_if_fail (G_IS_SOCKET (socket));<br>
><br>
><br>
> g_socket_close (socket, NULL);<br>
><br>
><br>
> }<br>
><br>
><br>
> But it don't solve the socket file descriptor leaks problem. While<br>
> doing track-fds using valgrind, I got these:<br>
><br>
><br>
> ==5605== FILE DESCRIPTORS: 822 open at exit.<br>
> ......<br>
> ==5605==<br>
><br>
> ==5605== Open AF_UNIX socket 821: <unknown><br>
> ==5605== at 0x5D13F8A: socketpair (syscall-template.S:82)<br>
> ==5605== by 0x4EA2227: gst_poll_new (gstpoll.c:569)<br>
> ==5605== by 0x4EA22FD: gst_poll_new_timer (gstpoll.c:630)<br>
> ==5605== by 0x4E6AA84: gst_bus_constructed (gstbus.c:152)<br>
> ==5605== by 0x54A1122: g_object_newv (gobject.c:1747)<br>
> ==5605== by 0x4E6B105: gst_bus_new (gstbus.c:286)<br>
> ==5605== by 0x4E9B6A5: gst_pipeline_init (gstpipeline.c:210)<br>
> ==5605== by 0x54BBDDE: g_type_create_instance (gtype.c:1912)<br>
> ==5605== by 0x549F6B7: g_object_constructor (gobject.c:1855)<br>
> ==5605== by 0x54A0CB0: g_object_newv (gobject.c:1719)<br>
> ==5605== by 0x4E7D44D: gst_element_factory_create<br>
> (gstelementfactory.c:377)<br>
> ==5605== by 0x4E7D60E: gst_element_factory_make<br>
> (gstelementfactory.c:446)<br>
> ==5605== by 0x4EDF184: priv_gst_parse_launch (grammar.y:965)<br>
> ==5605== by 0x4ED639C: gst_parse_launch_full (gstparse.c:324)<br>
> ==5605== by 0x405714: gst_worker_create_pipeline (gstworker.c:181)<br>
> ==5605== by 0x4052B4: gst_worker_prepare_unsafe (gstworker.c:611)<br>
> ==5605== by 0x40560F: gst_worker_reset (gstworker.c:708)<br>
> ==5605== by 0x40C91D: gst_composite_apply_parameters<br>
> (gstcomposite.c:332)<br>
> ==5605== by 0x40CD17: gst_composite_null (gstcomposite.c:540)<br>
> ==5605== by 0x4063D8: gst_worker_message (gstworker.c:438)<br>
> ......<br>
><br>
><br>
><br>
><br>
> Do you guys have any suggestion on this? Please help. Is it a bug?<br>
><br>
><br>
> Best Regards Sincerely<br>
> Duzy Chan<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>