From users-return-9694-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Tue Jun 26 17:12:01 2007 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 45776 invoked from network); 26 Jun 2007 17:11:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2007 17:11:49 -0000 Received: (qmail 6168 invoked by uid 500); 26 Jun 2007 17:11:51 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 6144 invoked by uid 500); 26 Jun 2007 17:11:51 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 6135 invoked by uid 99); 26 Jun 2007 17:11:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 10:11:51 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 10:11:45 -0700 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1I3EZY-0005F8-VB for users@activemq.apache.org; Tue, 26 Jun 2007 10:11:24 -0700 Message-ID: <11309857.post@talk.nabble.com> Date: Tue, 26 Jun 2007 10:11:24 -0700 (PDT) From: Jim_Cross To: users@activemq.apache.org Subject: Re: Orphan connections from .NET clients In-Reply-To: <11307469.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: jimcross1981@googlemail.com References: <4666F712.6000201@blackspark.com> <11269315.post@talk.nabble.com> <11290610.post@talk.nabble.com> <11301140.post@talk.nabble.com> <11307469.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Thanks Chris. I just tried this against the Active MQ running on my Windows box, and it worked fine. Then tried it against Active MQ running on the Linux server, and the connections leak appeared again. So it either seems to be related to the OS it's running on, or the fact that when running against my windows box the connections are effectively local... Dris wrote: > > OK, I compiled the following against a recent-ish version of NMS. I > haven't done a more recent compile because as I pointed out in the NMS > issue tracker there was a bug in the use of selectors which I had fixed in > my source but which hadn't been fixed in the SVN Repo (though it might > have been very recently). This is just your original post with your > disconnect logic shoved in the finally block. When I monitor this in > JConsole the connection gets cleaned up fine and there is no Connection > folder under localhost in the MBeans treeview. Hope this helps (though > obviously it doesn't I guess!). Happy to mail you my NMS.dll and > ActiveMQ.dll compiles for you to try. > > Chris > > > using System; > using System.Threading; > using NMS; > > namespace ActiveMQ > { > class TestMain > { > static void Main(string[] args) > { > Uri uri = new Uri("tcp://bhw152:61616"); > > ConnectionFactory factory = new ConnectionFactory(uri); > > IConnection connection = null; > ISession session = null; > > try > { > connection = factory.CreateConnection(); > Console.WriteLine("Connection Created"); > > connection.ClientId = "[test1] " + connection.ClientId; > > session = connection.CreateSession(); > Console.WriteLine("Session Created"); > > Thread.Sleep(10000); > } > finally > { > try > { > if (session != null) > { > session.Close(); > session.Dispose(); > } > > if (connection != null) > { > connection.Dispose(); > } > } > catch (Exception ex) > { > Console.WriteLine("ERROR DISCONNECTING: " + ex.StackTrace); > } > Console.WriteLine("Connection Closed"); > } > } > } > } > -- View this message in context: http://www.nabble.com/Orphan-connections-from-.NET-clients-tf3879502s2354.html#a11309857 Sent from the ActiveMQ - User mailing list archive at Nabble.com.