DEADLOCK  while closing the consumer
------------------------------------

                 Key: AMQNET-136
                 URL: https://issues.apache.org/activemq/browse/AMQNET-136
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ Client
    Affects Versions: 1.1
         Environment: windows XP machine. Using .net 3.5 and VS 2008
            Reporter: satya
            Assignee: Jim Gomes
             Fix For: 1.1


DEADLOCK SCENARIO:

the deadlock occurs on close method of IMessageConsumer. 

Here is the scenario... 
Lets say we have the class below. The producer is calling the MessgeConsumers 
callback method. 
In this case its onMessage() method. Now lets assume there are 30K messages to 
be received in the call back. When we are on the 10th message and the user 
closes the trace Window the CloseWindow() method is called and the application 
stalls at the message consumers close method. 
Hope I am clear enough. 

Class TraceWindow 
{ 
private IMessageConsumer consumerTrace = null; 
TraceWindow(Apache.NMS.IMessageConsumer iMessageConsumer) 
{ 
            this.consumerTrace = iMessageConsumer; 
            if (consumerTrace != null) 
            { 
                this.consumerTrace.Listener += new MessageListener(OnMessage); 
            } 
} 

 public void OnMessage(Apache.NMS.IMessage bMsg) 
{ 
        //inserts in WPF ObservableCollection 
            handleMessageDelegate Updater = new 
handleMessageDelegate(handleMessage); 
            
this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, 
                     Updater, obj);       
} 

public void handleMessage(Object item) 
        {                         
            lock (collectionTrace) 
            {   
                {                     
                    collectionTrace.Add(item); 
                    
LogManager.GetLogger("AlgoSystemCommunicatorLogger").Info(item);     
                } 
            } 
        }       


public void CloseWindow() 
{ 
   consumerTrace.Close();   //////////////////////SYSTEM STALLS ON THIS CALL 
} 

}//end of class 


A WORK AROUND THAT I HAVE found is as follows:
Before closing the consumer created on an ITemporaryTopic I call the 
DeleteDestination(IDestination destination) method to delete the temporary 
topic.
I then call the close method on the consumer and it works. If however I dont 
call the deleteDestination method above
there is a deadlock and the system stall. Just to add I have around 30000+ 
messages coming over the callback method for the consumer.
Not sure if the number of messages causes this.







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

Reply via email to