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:
- Some System V shared memory.
- A System V semaphore.
- A control file for the shared memory.
- A control file for the semaphore.
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 Java 6 SR4 and later,
record all semaphores IDs with corresponding keys having MSB 0xad.
- For Java 6 SR4 and later,
record all memory IDs with corresponding keys having MSB 0xde.
- For earlier versions of Java 6,
do the same by recording all semaphore IDs and all memory IDs, where
the corresponding keys begin with MSB in the range 0x01 to 0x14.
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.