Or to put it another way, it is hard top stop a resilient client connection using reconnect.
I was playing around with MQ reconnection, to see how resilient it was, and wanted to stop one instance of my server program.
I tried to use the display connections command to identify one of my server programs so I could stop it. I failed to do either of these. If I am missing something – please let me know.
echo “dis conn(*) where(appltag,eq,’serverCB’) all” |runmqsc QMA|less
and got several entries like the one below – the only significant difference was the TID value.
AMQ8276I: Display Connection details. CONN(21029D5C02AA7121) EXTCONN(414D5143514D41202020202020202020) TYPE(CONN) PID(10907) TID(36) APPLDESC(IBM MQ Channel) APPLTAG(serverCB) APPLTYPE(USER) ASTATE(STARTED) CHANNEL(COLIN) CLIENTID( ) CONNAME(127.0.0.1) CONNOPTS(MQCNO_HANDLE_SHARE_BLOCK,MQCNO_SHARED_BINDING, MQCNO_RECONNECT) USERID(colinpaice) UOWLOG( ) UOWSTDA(2019-03-29) UOWSTTI(08.10.58) UOWLOGDA( ) UOWLOGTI( ) URTYPE(QMGR) EXTURID(XA_FORMATID XA_GTRID XA_BQUAL) QMURID(0.12295) UOWSTATE(ACTIVE)
The Knowledge Center says
PID: Number specifying the process identifier of the application that is connected to the queue manager.
TID: Number specifying the thread identifier within the application process that has opened the specified queue.
I used the ps-ef command to show the process with pid of 10907 it gave
mqm 10907 10876 0 Mar28 ? 00:00:00 /opt/mqm/bin/amqrmppa -m QMA
amqrmppa is for Process Pooling. This acts as a proxy for your client program. This is clearly not my application.
One instance of amqrmppa can handle many connections. It creates threads to run the work on behalf of the client application. The TID is the thread number within the process.
If you have lots of clients you can have multiple instances of amqrmppa running.
So the following may be better definitions:
PID: Number specifying the process identifier of the application that is connected to the queue manager. For local bindings this is the process id. For clients this is the process id of the proxy service amqrmppa.
TID: Number specifying the thread identifier within the application process that has opened the specified queue. For clients this is the thread identified within an amqrmppa instance.
On my Ubuntu system, my bindings mode application had TID(1).
Even with this additional information, I was unable tie up the MQ connections with my program instances. I had 3 instances of serverCB running on the same machine.
If you had multiple machines, they would have a different conname, so you can identify which connection is for which machine – but you cannot tell which connection within a machine
I want to stop an instance.
There is a good technote How to identify MQ client connections and stop them.
This says to stop a connection use the MQ commandSTOP CONN(21029D5C02AA7121). My first problem is I dont know which connection is the one I want to stop.
But if this is a client using reconnect, the program will reconnect!
The technote suggests using the MQ command STOP CHL(…) status(inactive).
The applications using this channel (all of them) will get MQRC_CONNECTION_QUIESCING. If they stop, and are restarted, they will be able to reconnect to this queue manager (or any other available queue manager). This may be OK. (But you may not want to stop all of the applications using this channel definition)
If you use STOP CHL(…) status(stopped). The applications using this channel will get MQRC_CONNECTION_QUIESCING . If they stop, and are restarted, they will not be able to reconnect to this queue manager until the channel is started again. But they can connect to other queue managers which are active and the channel is available.
These clients with reconnection are certainly resilient!
If I am missing something important – please tell me!
One thought on “The display connection command doesn’t, and stop connection doesn’t.”
Remember about the STATUS(INACTIVE) option on the STOP CHANNEL command – very handy for SVRCONNs to leave the channel able to be restarted after the STOP command has kicked off the socket.