IBM Support

Why should I not run ipcrm nor amqiclen?

Question & Answer


Question

I have heard some people describe how they fixed a IBM MQ problem using "ipcrm" or "amqiclen". But is it safe to do this? What are the dangers?

Cause

In general, it is not advisable to use these tools.
If IBM MQ Support recommends using them, then that will be fine. 
For more details, see below section.

Answer

IBM MQ Support occasionally hears that customers are using ipcrm or amqiclen as part of their normal shutdown procedures.

For example, as part of a script that ends a queue manager using endmqm, they have added code after this command to call ipcrm against mqm-owned semaphore sets and shared memory segments.

IBM MQ Support advises that this should NOT be done and these can be run only if it is recommended by the IBM MQ Support team under certain circumstances. 
This document describes some of the reasoning for this advice.


+ Semaphores

It is potentially extremely dangerous for data integrity to remove IBM MQ's semaphores while they might still be referenced by a running part of IBM MQ.

IBM MQ uses the semaphores to manage concurrent access to shared data, and to determine whether another copy of the queue manager is already running.

If the semaphores are removed without first ending the queue manager, then a second queue manager can be started on the same machine at the same time.

This is an extremely serious problem because the second copy of the queue manager, thinking it has exclusive access to its data, begins immediately to reference the same queue and log data as is already being referenced by the original copy of the queue manager.

If this happens, the said queue and log data instantly becomes corrupted beyond repair.

The advice from IBM is, leave all of IBM MQ's semaphores in place, and never run ipcrm to remove them. This prevents the risk described above.


+ Shared memory

It is potentially harmful to remove IBM MQ's shared memory segments while there is any process attached to them.

If no processes are attached then it is not usually harmful. But it still is not needed, so the general advice is still not to do it.

This is a typical scenario. An administrator might end their queue manager and listeners but forget to end one or more of their IBM MQ applications.

A problem can arise if that application is bound to the queue manager using shared memory bindings (which is the norm [1]) and has not made an IBM MQI call for a while. Application processes like this can remain attached to IBM MQ's shared memory segments even though the queue manager has ended.

In this scenario, and supposing the application did not make another IBM MQI call, it will remain attached to the shared memory. The administrator will find that the queue manager later refuses to start, and error messages will be written by the strmqm command. The reason is that, during strmqm, the queue manager startup code detects the presence of those old applications and fails the startup processing.

The error messages from strmqm do state that the application(s) should be ended to allow the queue manager to start. The error messages also mention the process ID (pid) to make it easy to find the process concerned and end it.

Despite this, some system administrators have, in our experience, chosen to remove mqm-owned shared memory segments with ipcrm rather than end the applications, in order to allow strmqm to run. This does allow the queue manager to start, but later the applications can fail with a trap (SIGSEGV or similar), and an FDC file.

The advice from IBM is, leave all of IBM MQ's shared memory segments in place. Follow the instructions given in the error messages from strmqm. End the IBM MQ applications [2] that are still attached to the shared memory, and then strmqm will run successfully.


+ Tool: amqiclen

The amqiclen tool was developed to run as part of the IBM MQ installer. Its purpose is to check that it is safe to proceed with the install. The checks it makes are whether IBM MQ's shared memory segments are in use by any running processes.

The amqiclen tool is potentially just as dangerous to an IBM MQ system as the ipcrm command.

Therefore, for the same reason IBM MQ Support advises not to run ipcrm, we advise also not running amqiclen.

In fact amqiclen was not intended for use by IBM MQ users or administrators directly. When used directly its effects are not supported by IBM MQ Support unless they have specifically advised it while working through a PMR.

For more details see:
https://www.ibm.com/support/pages/node/6591157
IBM MQ - amqiclen failures encountered during the IBM MQ upgrade
Instead of running amqiclen to attempt to solve a perceived problem, please instead raise the matter with IBM in a PMR, so that IBM MQ Support can gather diagnostics and work through the issue to resolution.

+ Conclusion

There should never be a need for an administrator to manually remove IBM MQ's shared memory or semaphore sets from the OS.

IBM MQ has been written to tidy up after itself and so manage these things itself.

Therefore ipcrm and amqiclen should not need to be included in normal administration activities.

If you ever think IBM MQ has not managed these resources successfully, they should raise the matter with IBM in a PMR, so that IBM MQ Support can gather diagnostics and work through the issue to resolution. This can be run only if it is recommended by IBM MQ Support after analyzing the problem details.


Footnotes

[1] This situation does not affect applications that are connected via "isolated bindings".

[2] Ending IBM MQ applications is generally the cleanest way of causing them to disconnect from IBM MQ's shared memory, but perhaps you do not want to end the applications. If this is the case then another method exists, though this method is only possible if the application is coded sympathetically. In this alternative method, the application must be made to go into a new IBM MQI call. When it goes into the new IBM MQI call it will inspect the data in IBM MQ's shared memory and will find that the queue manager is not running. Upon finding this, the application will report a connection-broken style of error, and will disconnect from the shared memory.

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"ARM Category":[{"code":"a8m0z00000008MGAAY","label":"Install"}],"ARM Case Number":"TS008185447","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Product Synonym

WMQ MQ

Document Information

Modified date:
08 June 2022

UID

swg21414283