ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » Max channels when MQ Command server is down

Post new topic  Reply to topic
 Max channels when MQ Command server is down « View previous topic :: View next topic » 
Author Message
pavan-mq
PostPosted: Tue Apr 06, 2010 4:32 am    Post subject: Max channels when MQ Command server is down Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi Everyone,

i am new to Mq and i am using PCFMessage Agent to connect to the MQ and every thing is working fine for me untill this has happened.

if i try to connect to the MQ using pcfmessage agent when MQCommand server is down, it fails (not a problem), but it appears that the server connection channel is not terminated.

In turn, the connection will hang around and when i make subsequent attempts to connect at regular interval, the previous connection won't give up, eventually, the MQ server will hit the MAX CHANNELS configured to it then NO channels will be able to connect at all.

i checked the code and i am calling the disconnect() properly. Is there anything i am missing . Thanks in Advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 06, 2010 5:16 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

What you're missing is the guidance to new posters which explains it's considered rude to double post!

I've locked this version of your question.


_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Tue Apr 06, 2010 6:55 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

i thought i had posted the first one in different forum "websphere mq api support" that's why i posted again in correct one "general websphere mq support" Sorry for that.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 06, 2010 7:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

As it says in the guidance, if you post in the wrong forum just ask a moderator to move it.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Apr 06, 2010 9:26 am    Post subject: Re: Max channels when MQ Command server is down Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

Can you use DIS CHS and DIS CONN to find out whether the channels for your program really are the ones leaking.. If they are, you may need to find out why your disconnect() call is apparently not disconnecting.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Apr 06, 2010 8:06 pm    Post subject: Re: Max channels when MQ Command server is down Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mvic wrote:
Can you use DIS CHS and DIS CONN to find out whether the channels for your program really are the ones leaking.. If they are, you may need to find out why your disconnect() call is apparently not disconnecting.


Are you sure your disconnect call is rightly placed? What happens in case an exception is thrown. Do you still disconnect (try, catch , finally)?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
pavan-mq
PostPosted: Wed Apr 07, 2010 12:15 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Thanks for replies guys,

I have placed the disconnect() in finally block only. For reference i am posting my code here.

Code:


import java.io.*;
import java.util.*;
import com.ibm.mq.*;
import com.ibm.mq.pcf.*;

public class MQTest
{
   public  void main (String [] args)
   {
      String host="host";
      String port="1414";
      String channel="server_channel";
      
      if(args.length>0){
         host=args [0];
         port=args [1];
         channel=args [2];
      }
      System.out.print ("Connecting to queue manager at " + host + ":" + port + " over channel " + channel );
      
      PCFMessageAgent   agent=null;
      try{
         agent = new PCFMessageAgent (host, Integer.parseInt (port), channel);
                        getData(agent);
      }
      catch (ArrayIndexOutOfBoundsException abe){
         System.out.println ("Usage:\t java MQTest host port channel");
      }
      catch (PCFException pcfe){
         System.err.println ("Error in response: ");
         PCFMessage []    responses = (PCFMessage []) pcfe.exceptionSource;
         for (int i = 0; i < responses.length; i++){
            System.out.println (responses [i]);
         }
      }
      catch (MQException mqe){
         mqe.printStackTrace();
         System.out.println("Reason code   "+mqe.reasonCode);
         System.out.println("Exception is %%%%% :"+PCFConstants.lookupReasonCode (mqe.reasonCode));
      }      
      catch(Exception ex){
         ex.printStackTrace();
       }
       finally{                 
          try{
             if(agent!=null)
             agent.disconnect();   
         }
         catch(Exception ex){}
       }
      
   }

 
   public   void getData(PCFMessageAgent agent)
   {
      StringBuffer output=new StringBuffer();
        try{
      System.out.println("====== Output ======= \n");
         getQueueStats(agent);
      }      
      catch(Exception ex){
         ex.printStackTrace();
      }   
   }


   public   void getQueueStats(PCFMessageAgent agent)
   {
      StringBuffer queueOutput=new StringBuffer();

      try{
               PCFMessage    request;
               PCFMessage []    responses;
            request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q);
            request.addParameter (CMQC.MQCA_Q_NAME, "*");
             request.addParameter (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
            request.addParameter (CMQCFC.MQIACF_Q_ATTRS,
                           new int [] {
                              CMQC.MQCA_Q_NAME,CMQC.MQIA_CURRENT_Q_DEPTH,
                              CMQC.MQIA_OPEN_INPUT_COUNT,
                              CMQC.MQIA_OPEN_OUTPUT_COUNT,
                              CMQC.MQIA_DEFINITION_TYPE});
                              
            responses = agent.send (request);
            
            queueOutput.append("Queue Name \t | Current Depth \t | % of Queue Occupied \t | Open Input Count \t | Open Output Count");
            queueOutput.append("\n");
   
            for (int i = 0; i < responses.length; i++)
            {
               String       name = responses [i].getStringParameterValue (CMQC.MQCA_Q_NAME);
               int       depth = responses [i].getIntParameterValue (CMQC.MQIA_CURRENT_Q_DEPTH);
               int         inputCount=responses [i].getIntParameterValue (CMQC.MQIA_OPEN_INPUT_COUNT);
               int         outputCount=responses [i].getIntParameterValue (CMQC.MQIA_OPEN_OUTPUT_COUNT);
               int         maxdepth=responses [i].getIntParameterValue (CMQC.MQIA_MAX_Q_DEPTH);
                      //% Queue Depth occupied of Max Queue Depth
                  int         percentQueueOcccupied=(depth*100)/maxdepth;
   
   
                   //int         qtype=responses [i].getIntParameterValue (CMQC.MQIA_Q_TYPE);
                   // MQIA_DEFINITION_TYPE was 3 for temporary queues and 1 for all other queues
                   // This was found out by listing attributes of the queue and check.
                   // need to find out how to filter System Queues also.
                   int         def_type=responses [i].getIntParameterValue (CMQC.MQIA_DEFINITION_TYPE);
   
                   if(def_type!=1)
                   continue;
                  
               queueOutput.append(name +"\t |"+ depth +"\t |"+ percentQueueOcccupied +"\t |"+ inputCount +"\t |"+ outputCount);
               queueOutput.append("\n");
            }
         }

            catch (PCFException pcfe){
            System.err.println ("Error in response: ");
            PCFMessage []    responses = (PCFMessage []) pcfe.exceptionSource;

            for (int i = 0; i < responses.length; i++){
               System.out.println (responses [i]);
            }
         }
         catch (MQException mqe){
            mqe.printStackTrace();
            System.out.println("TEST222  "+mqe.reasonCode);
            System.err.println (mqe);
         }
         catch (IOException ioe){
            ioe.printStackTrace();
         }
         catch(Exception ex){
            ex.printStackTrace();
         }
         
         System.out.println(queueOutput.toString());
   }

   
}
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Apr 07, 2010 5:24 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you given any thought to running your app with a coverage trace while forcing the issue ( cmd srvr down)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
pavan-mq
PostPosted: Fri Apr 09, 2010 4:22 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

I enabled the trace, but its hard to find any information from those traces for newbie's like me . i looked into the queue's error logs which says that
Quote:
Channel program 'channel_1' ended abnormally. There are too many channels active to start another.


while getting the trace by forcing the issue i found that the connections created by the application when command server is down is not giving up even after starting the command server.

Checking the applications connected to the QueueManager, i found the connections made from application when cmd server is down are in suspended state.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Apr 09, 2010 11:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well the coverage trace would tell you exactly if you execute the disconnect from the qmgr when the command server is down...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Max channels when MQ Command server is down
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.