<div dir="ltr"><div style>Honestly I'm not very sure about the real cause. I think it might have failed to request some resources. I added many locks for many situation (my latest code is at <a href="https://github.com/duzy/gst-switch">https://github.com/duzy/gst-switch</a>), and changed a method of log messages, refactored my code a lot, and <span style="font-family:arial,sans-serif;font-size:13px"><b>gst_bus_create_watch</b> issue seems gone</span>. But I'm now confronting another issue, complaining:</div>
<div style><br></div><div style><div style><font color="#666666">(gst-switch-srv:1709): GLib-ERROR **: <b>Creating pipes for GWakeup: Too many open files</b></font></div></div><div style><br></div><div style>This is happened almost 100% percent, by running the a test for nearly 2 minutes. And this test was trying to make request to <b>gst-switch-srv</b> indirectly to recreate the pipelines repeatedly and very fast (I spawned three threads in the test for making the requests to the server, and it will at least recreate three pipelines in a request).</div>
<div style><br></div><div style>Everything looks fine, except for the <b>too-many-open-files</b> error. And this time my stack looks like this (the latest changes):</div><div style><br></div><div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style><div style><font color="#666666"><b>bt</b></font></div><div style><font color="#666666">#0 <b>g_logv</b> (log_domain=0x7ffff72d11ae "GLib", log_level=G_LOG_LEVEL_ERROR, format=<optimized out>, args=args@entry=0x7fffffffddb8) at /build/buildd/glib2.0-2.34.1/./glib/gmessages.c:974</font></div>
<div style><font color="#666666">#1 0x00007ffff7297e42 in <b>g_log</b> (log_domain=log_domain@entry=0x7ffff72d11ae "GLib", log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x7ffff7323030 "Creating pipes for GWakeup: %s\n") at /build/buildd/glib2.0-2.34.1/./glib/gmessages.c:1003</font></div>
<div style><font color="#666666">#2 0x00007ffff72cd113 in <b>g_wakeup_new</b> () at /build/buildd/glib2.0-2.34.1/./glib/gwakeup.c:163</font></div><div style><font color="#666666">#3 0x00007ffff728ed47 in <b>g_main_context_new</b> () at /build/buildd/glib2.0-2.34.1/./glib/gmain.c:590</font></div>
<div style><font color="#666666">#4 0x00007fffd1cb1071 in <b>gst_multi_socket_sink_start_pre</b> (mhsink=0x23564d0) at gstmultisocketsink.c:1005</font></div><div style><font color="#666666">#5 0x00007fffd1cacc50 in <b>gst_multi_handle_sink_start</b> (bsink=0x23564d0) at gstmultihandlesink.c:2112</font></div>
<div style><font color="#666666">#6 <b>gst_multi_handle_sink_change_state</b> (element=0x23564d0, transition=<optimized out>) at gstmultihandlesink.c:2205</font></div><div style><font color="#666666">#7 0x00007ffff7b2e28c in <b>gst_element_change_state</b> (element=element@entry=0x23564d0, transition=<optimized out>) at gstelement.c:2594</font></div>
<div style><font color="#666666">#8 0x00007ffff7b2ec61 in <b>gst_element_set_state_func</b> (element=0x23564d0, state=GST_STATE_READY) at gstelement.c:2550</font></div><div style><font color="#666666">#9 0x00007ffff7b16579 in <b>gst_bin_element_set_state</b> (next=GST_STATE_READY, current=GST_STATE_NULL, start_time=0, base_time=0, element=0x23564d0, bin=0x217f1b0) at gstbin.c:2308</font></div>
<div style><font color="#666666">#10 <b>gst_bin_change_state_func</b> (element=0x217f1b0, transition=GST_STATE_CHANGE_NULL_TO_READY) at gstbin.c:2610</font></div><div style><font color="#666666">#11 0x00007ffff7b2e28c in <b>gst_element_change_state</b> (element=element@entry=0x217f1b0, transition=<optimized out>) at gstelement.c:2594</font></div>
<div style><font color="#666666">#12 0x00007ffff7b2ec61 in <b>gst_element_set_state_func</b> (element=0x217f1b0, state=GST_STATE_READY) at gstelement.c:2550</font></div><div style><font color="#666666">#13 0x0000000000405961 in <b>gst_worker_start</b> (worker=0x62f0f0) at gstworker.c:236</font></div>
<div style><font color="#666666">#14 0x000000000040bc30 in <b>gst_composite_close_transition</b> (composite=0x706800) at gstcomposite.c:513</font></div><div style><font color="#666666">#15 <b>gst_composite_alive</b> (composite=0x706800) at gstcomposite.c:565</font></div>
<div style><font color="#666666">#16 0x00000000004063ca in <b>gst_worker_state_paused_to_playing</b> (worker=0x706800) at gstworker.c:412</font></div><div style><font color="#666666">#17 <b>gst_worker_pipeline_state_changed</b> (statechange=<optimized out>, worker=0x706800) at gstworker.c:463</font></div>
<div style><font color="#666666">#18 <b>gst_worker_message</b> (bus=<optimized out>, message=0x7fffd80138a0, worker=0x706800) at gstworker.c:542</font></div><div style><font color="#666666">#19 0x00007ffff7b1dc67 in <b>gst_bus_source_dispatch</b> (source=source@entry=0x23614f0, callback=0x405b40 <gst_worker_message>, user_data=0x706800) at gstbus.c:773</font></div>
<div style><font color="#666666">#20 0x00007ffff7290ab5 in <b>g_main_dispatch</b> (context=0x61f2d0) at /build/buildd/glib2.0-2.34.1/./glib/gmain.c:2715</font></div><div style><font color="#666666">#21 <b>g_main_context_dispatch</b> (context=context@entry=0x61f2d0) at /build/buildd/glib2.0-2.34.1/./glib/gmain.c:3219</font></div>
<div style><font color="#666666">#22 0x00007ffff7290de8 in <b>g_main_context_iterate</b> (context=0x61f2d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/buildd/glib2.0-2.34.1/./glib/gmain.c:3290</font></div>
<div style><font color="#666666">#23 0x00007ffff72911e2 in <b>g_main_loop_run</b> (loop=0x706760) at /build/buildd/glib2.0-2.34.1/./glib/gmain.c:3484</font></div><div style><font color="#666666">#24 0x00000000004044c0 in <b>gst_switch_server_run</b> (srv=0x708000) at gstswitchserver.c:1095</font></div>
<div style><font color="#666666">#25 <b>main</b> (argc=1, argv=0x7fffffffe578) at gstswitchserver.c:1119</font></div><div style><br></div></div></blockquote></div><div style>The top several call frames are almost 100% percent path. And the key location of my client code is at:</div>
<div style><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><div style><a href="https://github.com/duzy/gst-switch/blob/switch/tools/gstworker.c#L681">https://github.com/duzy/gst-switch/blob/switch/tools/gstworker.c#L681</a><br>
</div><div style><br></div></div></blockquote>Which is doing recreation of three pipelines. I've been tracking on it for some days, but not yet have found the exact cause point. But I'm very sure that those leaked file descriptors are all of "unix socket" class, and should be created by <b>g_unix_open_pipe</b>. E.g. those already opened files (part, total 1024):<div>
<br></div><div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><div style>....</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 750 -> socket:[2418126]</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 751 -> socket:[2418138]</div>
<div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 752 -> socket:[2418139]</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 753 -> socket:[2418140]</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 754 -> socket:[2417418]</div>
<div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 755 -> socket:[2417357]</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 756 -> socket:[2417358]</div><div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 757 -> socket:[2415573]</div>
<div style> lrwx------ 1 duzy duzy 64 Feb 4 01:46 758 -> socket:[2415574]</div><div style>....</div><div style><br></div></div></blockquote>I'm now think that if my previous issue was actually not solved, and that's actually very much related to too-many-open-files issue. Say:</div>
<div style><br></div><div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><div style="font-family:arial,sans-serif;font-size:13px">GStreamer-CRITICAL **: gst_poll_get_read_gpollfd: assertion `set != NULL' failed</div>
<div style="font-family:arial,sans-serif;font-size:13px">GStreamer-CRITICAL **: gst_bus_create_watch: assertion `bus->priv->poll != NULL' failed<br></div><div style="font-family:arial,sans-serif;font-size:13px">
GLib-CRITICAL **: g_source_set_callback: assertion `source != NULL' failed</div></div></blockquote><div style><br></div><div style>Hope you would have some ideas.</div><div style><br></div><div style>Best Regards</div>
<div style>Duzy Chan</div><div style><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 26, 2013 at 7:50 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 Sat, 2013-01-26 at 08:08 +0800, Duzy Chan wrote:<br>
<br>
> Problem solved. Thanks all.<br>
<br>
So what was the problem/solution? Something in your code?<br>
<br>
Cheers<br>
-Tim<br>
<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>