Nonpersistent shared cache cleanup

When using UNIX® System V workstations, you might want to clean up the cache files manually.

When using nonpersistent caches on UNIX System V workstations, four artifacts are created on the system:

The control files are used to look up the System V IPC objects. For example, the semaphore control file provides information to help find the System V semaphore. During system cleanup, ensure that you do not delete the control files before the System V IPC objects are removed.

To remove artifacts, run a J9 JVM with the -Xsharedclasses:nonpersistent,destroy or -Xsharedclasses:destroyAll command-line options. For example:
java –Xshareclasses:nonpersistent,destroy,name=mycache
or
java –Xshareclasses:destroyAll

It is sometimes necessary to clean up a system manually, for example when the control files have been removed from the file system.

For Java™ 6 SR4 and later, manual cleanup is required when the JVM warns that you are attaching to a System V object that might be orphaned because of a missing control file. For example, you might see messages like the following output:
JVMPORT021W You have opened a stale System V shared semaphore: file:/tmp/javasharedresources/C240D2A64_semaphore_sharedcc_J9BUILD_G06 semid:15994888
JVMPORT020W You have opened a stale System V shared memory: file:/tmp/javasharedresources/C240D2A64_memory_sharedcc_J9BUILD_G06 shmid:1056778
J9 JVMs earlier than Java 6 SR4 produce error messages like the following to indicate a problem with the system:
JVMSHRC020E An error has occurred while opening semaphore
JVMSHRC017E Error code: -308
JVMSHRC320E Error recovery: destroying shared memory semaphores.
JVMJ9VM015W Initialization error for library j9shr24(11):
JVMJ9VM009E J9VMDllMain failed
In response to these messages, run the following command as root, or for each user that might have created shared caches on the system:
ipcs -a
For each System V semaphore ID, run the command:
ipcrm –s <semid>
where <semid> is the recorded System V semaphore ID.
For each System V shared memory ID, run the command:
ipcrm –m <shmid>
where <shmid> is the recorded System V shared memory ID.


© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)