IBM MQ reason code

MQRC 2161: Queue manager quiescing

MQRC 2161 (MQRC_Q_MGR_QUIESCING, hex 0871) means the queue manager is quiescing, which is a controlled shutdown, and the call failed so the application can finish its work and disconnect. It is a signal to end cleanly, not a fault.

Other names for this code

Also written as RC2161, reason code 2161, MQ 2161, MQ error 2161, MQRC_Q_MGR_QUIESCING, 0871, 0x0871, queue manager quiescing, FAIL_IF_QUIESCING, MQJE001 Reason 2161.

What it means

When an administrator stops a queue manager in a controlled way, it quiesces. It lets connected applications keep working and waits for them to disconnect before it ends. During that time, MQOPEN, MQPUT, MQPUT1 and MQGET can still succeed. An application can ask to be told about the shutdown instead, with MQOO_FAIL_IF_QUIESCING on MQOPEN, MQPMO_FAIL_IF_QUIESCING on puts and MQGMO_FAIL_IF_QUIESCING on gets. Those calls then fail with MQCC_FAILED and reason 2161.

That option matters for the operator. A controlled shutdown (endmqm with the default -c option on distributed MQ, or STOP QMGR with the default MODE(QUIESCE) on z/OS) waits for applications. A program that never uses the fail-if-quiescing options and sits in a long MQGET wait can keep the queue manager from stopping. Programs that handle 2161 let it stop on time.

IBM lists two other cases. On z/OS, a batch application on an LPAR with no queue manager installed, or a CICS application with no connection established, can receive 2161. On IBM i, an application in compatibility mode with no connection can receive it.

Common causes

  • An administrator started a controlled shutdown with endmqm QM1 or endmqm -c QM1 on distributed MQ.
  • On z/OS, an operator issued STOP QMGR or STOP QMGR MODE(QUIESCE).
  • A planned failover or maintenance window that stops the queue manager in a controlled way.
  • On z/OS, a batch job runs on an LPAR without a queue manager, or a CICS program runs when CICS has no MQ connection.

How to find the problem

  1. Check the queue manager error log or z/OS SYSLOG for the shutdown messages and the time they started.
  2. Run dspmq on distributed MQ. It shows the status as Quiescing while a controlled shutdown is in progress.
  3. If the shutdown seems stuck, list the remaining connections with DISPLAY CONN(*) APPLTAG to see which applications haven't disconnected.
  4. On z/OS CICS, check the adapter connection with CKQC or CEMT INQUIRE MQCONN.

How to fix it

  • Make the application end tidily on 2161. Commit or back out its unit of work, close its queues and disconnect.
  • If the program needs to finish a unit of work, it can repeat the call without the fail-if-quiescing option, but it shouldn't start new work.
  • Use the fail-if-quiescing options on every MQOPEN, MQPUT and MQGET in long-running programs, so they never hold up a shutdown.
  • Restart or reconnect the application after the queue manager is back, either by hand or with retry logic.

IBM documentation

IBM documentation: MQRC 2161. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

Is MQRC 2161 an error?

Not really. It is the queue manager telling the application to finish up because a controlled shutdown is under way.

What is the difference between 2161 and 2162?

2161 comes during a controlled shutdown and the application can still finish its current work. 2162 means the queue manager is stopping and no more MQI calls will work.

Why does endmqm take so long to finish?

A controlled shutdown waits for applications to disconnect. Programs that don't use the fail-if-quiescing options, especially ones in long MQGET waits, keep it waiting.