Unused Semaphores and Shared Memory Left After Abnormal Exit

Abnormal exits may leave unused semaphores and shared memory.

AIX, HP-UX, and Linux platforms use semaphores for communication between clients and servers on the same computer. Each client allocates one semaphore, as does each server. A client signals the server's semaphore when it has placed a packet for the server to read, and vice versa. The number of semaphores needed for a given system depends on how many local client applications connect via shared memory to the local server. If a client needs to allocate multiple semaphores for multiplex connections to one or more servers, it attempts to allocate all semaphores in the semaphore group.

Possible Causes

Killing processes on UNIX systems may result in semaphores or shared memory being left behind instead of being cleaned up automatically. To eliminate unneeded semaphores, periodically run the UNIX ipcs command to check the status of semaphores and shared memory.

The ipcs -a command lists the ID numbers, owners, and create times of semaphores and shared memory segments. When all SAP Sybase IQ instances are started by the same user (which is recommended), you can search the OWNER column for that user name. Identify shared memory segments and semaphores that are not being used.

Action

After verifying with the owner that these shared memory segments and semaphores are not in use, run the UNIX ipcrm command to remove them. Use the -m parameter to specify the memory segment ID and the -s command to specify the semaphore ID number, in the following format:
ipcrm -m mid1 -m mid2 ... -s sid1 -s sid2 ...
For example:
% ipcrm -m 40965 -s 5130 -s36682