You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Kelly Elias (JIRA)" <ji...@apache.org> on 2011/01/05 20:53:47 UTC

[jira] Created: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Session.CreateSession creates a thread that never gets disposed.
----------------------------------------------------------------

                 Key: AMQNET-301
                 URL: https://issues.apache.org/jira/browse/AMQNET-301
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: NMS
    Affects Versions: 1.4.1, 1.4.0, 1.3.0, 1.2.0
         Environment: Tested on Windows 7 and Windows Server 2008
            Reporter: Kelly Elias
            Assignee: Jim Gomes
            Priority: Critical


The Factory.CreateSession function creates a thread that never gets disposed.


If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.

Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.


CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------


using System;
using System.Threading;
using Apache.NMS;
using Apache.NMS.ActiveMQ;
using Apache.NMS.ActiveMQ.Commands;

namespace ThreadTest
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("sending");

                //"tcp://localhost:61616/"
                IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
                using (IConnection connection = factory.CreateConnection())
                {
                    //Create the Session
                    using (ISession session = connection.CreateSession())
                    {
                        //Create the Producer for the topic/queue
                        IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));

                        ITextMessage msg = prod.CreateTextMessage();
                        msg.Text = "test";

                        prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
                    }
                }

                Thread.Sleep(5000);
            }
        }
    }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978406#action_12978406 ] 

Timothy Bish commented on AMQNET-301:
-------------------------------------

You need to add a reference to the Apache.NMS.dll located in the lib folder of the binary distribution.  

> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Kelly Elias (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978404#action_12978404 ] 

Kelly Elias commented on AMQNET-301:
------------------------------------

When I attempt to use that snapshot I get the following:

"Could not load file or assembly 'Apache.NMS, Version=1.5.0.2188, Culture=neutral, PublicKeyToken=82756feee3957618' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

I used the bin.


> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977999#action_12977999 ] 

Timothy Bish commented on AMQNET-301:
-------------------------------------

A recent SNAPSHOT build is located here: http://people.apache.org/~tabish/nms-1.5.0/

> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Kelly Elias (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977996#action_12977996 ] 

Kelly Elias commented on AMQNET-301:
------------------------------------

I haven't been able to try out the 1.5 version yet as the links for the client downloads of the Apache.NMS.ActiveMQ don't appear to work yet. But all the previous versions up to 1.1 seem to have the issue. Once I can get the client dll, I'll give 1.5 a try.

> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Kelly Elias (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelly Elias resolved AMQNET-301.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.0

Was a problem in 1.2, 1.3 and 1.4 versions.  Fixed in 1.5.


> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.5.0
>
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-301) Session.CreateSession creates a thread that never gets disposed.

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQNET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977958#action_12977958 ] 

Timothy Bish commented on AMQNET-301:
-------------------------------------

I've run this test using the 1.5.0 SNAPSHOT and don't see any thread leakage.

> Session.CreateSession creates a thread that never gets disposed.
> ----------------------------------------------------------------
>
>                 Key: AMQNET-301
>                 URL: https://issues.apache.org/jira/browse/AMQNET-301
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.4.1
>         Environment: Tested on Windows 7 and Windows Server 2008
>            Reporter: Kelly Elias
>            Assignee: Jim Gomes
>            Priority: Critical
>
> The Factory.CreateSession function creates a thread that never gets disposed.
> If you run the code in visual studio and step through each line you will notice that on the first iteration of the loop two threads are created on the factory.CreateConnection line. Only one is cleaned up. Then each iteration after one thread is created on factory.CreateSession and is cleaned up correctly, but a second on is created on connection.CreateSession and is not cleaned up. Every iteration will then make a thread on connection.CreateSession that does not get cleaned up.
> Interesting, this occurs with every version I've tested except the old 1.1 version. That version cleans up correctly.
> CODE TO REPRODUCE THE ISSUE-----------------------------------------------------------------
> using System;
> using System.Threading;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS.ActiveMQ.Commands;
> namespace ThreadTest
> {
>     internal class Program
>     {
>         private static void Main(string[] args)
>         {
>             while (true)
>             {
>                 Console.WriteLine("sending");
>                 //"tcp://localhost:61616/"
>                 IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
>                 using (IConnection connection = factory.CreateConnection())
>                 {
>                     //Create the Session
>                     using (ISession session = connection.CreateSession())
>                     {
>                         //Create the Producer for the topic/queue
>                         IMessageProducer prod = session.CreateProducer(new ActiveMQTopic("KELLYTEST"));
>                         ITextMessage msg = prod.CreateTextMessage();
>                         msg.Text = "test";
>                         prod.Send(msg, MsgDeliveryMode.NonPersistent, MsgPriority.Normal, TimeSpan.MinValue);
>                     }
>                 }
>                 Thread.Sleep(5000);
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.