activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim_Cross <jimcross1...@googlemail.com>
Subject Re: Orphan connections from .NET clients
Date Wed, 27 Jun 2007 07:23:20 GMT

OK, just tried a copy and paste of your code against a remote Windows box,
and the connection leak appears there as well, so for me it only works
correctly when run against ActiveMQ on my local box.
Does it work for you on a remote machine also? If so, could you please mail
me your NMS.dll and ActiveMQ.dll?

Thanks,

Jim



Jim_Cross wrote:
> 
> 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#a11319677
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message