On distributed MQ after you have issued the endmqm queue_manager command,  you find your queue manager is not shutting down. What can you do about it?

  1. The classic problem  is not having options like MQGMO_FAIL_IF_QUIESCING specified on an MQGET.  If this is not specified the get waits until it times out.
  2. An applicatoin with *.FAIL_IF_QUESCING will only get  return code  MQRC_Q_MGR_QUIESCING, on the next MQ API call.  For example the AMQSMPUT sample.
    This does
    read from terminal
    MQPUT
    Loop
    So while while the application is waiting for you to type in data, it will not get notified that MQ is going down.  After you enter data and press enter,  the MQPUT will get MQRC_Q_MGR_QUIESCING and so the application can close the queue and end the application, and MQ will shut down.
    Another example is your application does an MQGET, then spends minutes doing database updates.

The endmqm -i option will break the connection to MQ without waiting for the next API requests.

What threads are still connected to MQ?

The

dspmq -c

command provides a list of what processes the queue manager thinks are connected to shared memory associated with that queue manager.   This list includes internal processes, listeners and applications.
In extreme circumstances (.e.g. frequent Pid re-use and disabling process exit handlers) the list might include a process that is NOT connected to the queue managers shared memory, but at least one of the processes that is listed is guaranteed to have been connected at the instant the command was executed. The processes identified with the PID’s output by the command should then be examined in more detail to identify processes that are preventing an orderly shutdown of the queue manager.

The output is like

QMNAME(colin)                                             STATUS(Running)
    SUBPOOL(colin)                                            PID(7895)
    SUBPOOL(colin)                                            PID(5145)

You can use platform specific commands to display more information about the PID.  For example on Linux the

ps -ef |grep 7985

command gave

paice     7895  7240  0 09:58 pts/1    00:00:00 ./mainy -mcolin -rCP0000

This shows the command was  ./mainy.
Commands beginning with amq and runmq are internal MQ processes and should typically be ignored

On unix you can use the bash command string

for i in `dspmq -c | xargs -n1 | grep PID | cut -d'(' -f2 | cut -d')' -f1`; do ps -p $i -o user,pid,args; done

to display all of the processes and their command

2 comments on"Why isn’t my queue manager shutting down?"

  1. Akash Lodhi July 31, 2017

    Hi,
    I want to know about the basics of MQ appliance.

Leave a Reply