Krzysztof Porebski created AMQNET-633:
-----------------------------------------

             Summary: Cannot create Session when Connection not started
                 Key: AMQNET-633
                 URL: https://issues.apache.org/jira/browse/AMQNET-633
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: AMQP
    Affects Versions: 1.8.0
            Reporter: Krzysztof Porebski
             Fix For: AMQP-1.8.1


There is a problem with creating of nms sessions when connection is not started 
upfront. The issue reveals itself only in multi-threaded environment. The 
following integration test can be used to recreate the issue. 


{code:java}
public class NmsSessionTest : AmqpTestSupport
{
    [Test, Timeout(10_000)]
    public void 
TestCreateMultipleSessionsFromDifferentThreadsWhenConnectionNotStarted()
    {
        Connection = CreateAmqpConnection();
        Assert.NotNull(Connection);

        Parallel.For(0, 10, i =>
        {
            ISession session = Connection.CreateSession();
            Assert.NotNull(session);
        });
    }
}
{code}
 

As a result following exception is thrown:


{code:java}
System.NullReferenceException: Object reference not set to an instance of an 
object.
  at at Amqp.Session..ctor(Connection connection, Begin begin, OnBegin onBegin)
  at Apache.NMS.AMQP.Provider.Amqp.AmqpSession.Start() in 
C:\git\activemq-nms-amqp\src\NMS.AMQP\Provider\Amqp\AmqpSession.cs:71
  at Apache.NMS.AMQP.Provider.Amqp.AmqpConnection.CreateSession(NmsSessionInfo 
sessionInfo) in 
C:\git\activemq-nms-amqp\src\NMS.AMQP\Provider\Amqp\AmqpConnection.cs:150{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to