<div>Dave,</div><div><br></div>This patch only would come into play if you were sending the linger command over the socket once connected.<div>Before the patch, if you executed "linger" it would never disconnect the socket until you did it yourself from the client side.</div>
<div>After the patch it should apply a default timeout of 600 seconds or allow you to specify a smaller one such as "linger 20"</div><div>In any case this would be moot if you manually call the disconnect yourself before you close your script.</div>
<div><br></div><div>Are you sure this patch is causing you problems? This really should go in a JIRA if so, at least re-open the existing one that added the patch and post your findings.</div><div><br></div><div>Also the guy with the local mods to the java stuff, please contribute them and we can add them to tree.</div>
<div><br></div><div><br><div><br><br><div class="gmail_quote">On Sat, Dec 17, 2011 at 6:26 AM, Dave May <span dir="ltr"><<a href="mailto:Dave.May@patlive.com">Dave.May@patlive.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="color:#1f497d">I experienced similar problems when load testing Plivo on the latest Git, but didn't feel like I had enough data gathered for a "proper" report. After each call, the remote ESL socket would be left in a CLOSE_WAIT state.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">I think the problem started on December 8th, with the resolution of this Jira:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:.5in"><span style="color:#1f497d"><a href="http://jira.freeswitch.org/browse/FS-3750" target="_blank">http://jira.freeswitch.org/browse/FS-3750</a><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:.5in"><a href="http://fisheye.freeswitch.org/browse/freeswitch.git/src/mod/event_handlers/mod_event_socket/mod_event_socket.c?r2=19dad4a527e4e87bdbecf7b97e3d07fd11e2a04c&r1=6bd2798ea1df47e2a5b9de99defbd79e33f5726f" target="_blank">http://fisheye.freeswitch.org/browse/freeswitch.git/src/mod/event_handlers/mod_event_socket/mod_event_socket.c?r2=19dad4a527e4e87bdbecf7b97e3d07fd11e2a04c&r1=6bd2798ea1df47e2a5b9de99defbd79e33f5726f</a><span style="color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">When I rolled the code back to the revision just prior to this change, my problems went away.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal" style="text-indent:.5in"><span style="color:#1f497d">git checkout 1868e145201cc6ba5a14d6929695977780917a38<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Dave.<u></u><u></u></span></p><div class="im"><p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Neil Davis<br>
<b>Sent:</b> Friday, December 16, 2011 7:09 PM<br><b>To:</b> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><b>Subject:</b> [Freeswitch-users] Threads remain after calling close on Java client<u></u><u></u></span></p>
</div></div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">Hi,<u></u><u></u></p><div><div></div><div class="h5"><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">I built a web application that connects to Freeswitch using the org.freeswitch.esl.client.Client. I connect the Client object from a Spring annotated service that I call from a Spring controller. I put the connected client in my ServletContext, so I can access it later to call client.cancelEventSubscriptions() and client.close() from my ServletContextListener contextDestroyed method when Tomcat is shutting down.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">The problem I'm having is that even after I call close on the client, there are still a bunch of active threads that the client has spawned in the background. These threads are causing Tomcat to hang when I'm shutting down. Can anyone suggest an approach that would enable my application to disconnect the Freeswitch client when Tomcat is shutting down that would allow Tomcat to shutdown gracefully?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Below are errors from my Tomcat log for the threads that I have identified as being related to the Freeswitch client. I don't know how I can get to these threads to interrupt them and Client.close() seems to leave them hanging.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-1] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-3-thread-1] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-4-thread-1] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-2] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-3] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-4] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-5] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-6] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-7] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-8] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-9] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-10] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-11] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-12] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-13] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-14] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-15] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-16] but has failed to stop it. This is very likely to create a memory leak.<u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.internal.ThreadLocalBoolean] (value [org.jboss.netty.util.internal.ThreadLocalBoolean@186e192]) and a value of type [java.lang.Boolean] (value [false]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. <u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.CharsetUtil$1] (value [org.jboss.netty.util.CharsetUtil$1@14d8e1]) and a value of type [java.util.IdentityHashMap] (value [{windows-1252=sun.nio.cs.MS1252$Encoder@373f86}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. <u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.internal.ThreadLocalRandom$1] (value [org.jboss.netty.util.internal.ThreadLocalRandom$1@12bb519]) and a value of type [org.jboss.netty.util.internal.ThreadLocalRandom] (value [org.jboss.netty.util.internal.ThreadLocalRandom@7e9dbc]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. <u></u><u></u></p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks<u></u><u></u></p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.CharsetUtil$1] (value [org.jboss.netty.util.CharsetUtil$1@14d8e1]) and a value of type [java.util.IdentityHashMap] (value [{windows-1252=sun.nio.cs.MS1252$Encoder@a5b041}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Thanks,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Neil Davis<u></u><u></u></p></div>
</div></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div></div>