Skip to main content

Problem:

  • Product Name: VisiBroker for C
  • Product Version: 5.x
  • Product Component: Core ORB
  • Platform/OS Version: HP-UX, AIX, Linux
  • Compiler Version: n.a.

VBC 5.x : Queries on shared memory usage

  1. How is the maintenance of shared memory (e.g. creation, deletion, update, etc.) performed?
  2. How does process operation (e.g. restart, shutdown, or abnormal termination like coredump, etc.) affect shared memory?
  3. Is it possible to check whether shared memory (???)
  4. Is it possible to either reuse or delete shared memory before creating next instance when Server is restarted after an abnormal shutdown?

Resolution:

By default, VBC 5.x uses Shared Memory for LIOP on HP-UX, AIX, Linux platforms.

Answers to Questions 1 and 2 :

The shared memory region is created during the server process startup.
The default size of it is 4096 or 1-page-file size, which ever is bigger.
It can be adjusted using the following property :

vbroker.se.default.local.listener.shmSize

Once the shared memory region is created, it's size is not changed throughout the session.
If the server is shutdown using Ctrl-C (signal 2 and 15), or through orb->shutdown, the shared memory gets deleted properly. If, on the other hand, server process is killed using -9 signal, the server cannot cleanup the shared memory.

It internally uses semaphores (System V) to signal while using the shared memory. Abnormal termination may cause the system to run out of total available semaphores, in which case the shared memory channel will not be effective. The user application will not receive any warning or exception

The client does not attempt to send through shared memory if the payload size is bigger than the shared memory size. It uses the Unix Domain socket in such cases. If sending through the shared memory fails with any reason, it always falls back to Unix domain socket.

The shared memory channel can be disabled by using the following property during Server startup :

vbroker.se.default.local.listener.shm=false

Question 3: The shared memory and semaphores are created during the ORB_init time of the
Server start up. Unless explicitly disabled, they will get created. Whether the request goes through shared memory or Unix Domain socket will be transparent to the user.

Question 4. Reusing the shared memory is not possible and does not even have any meaning. Only thing is a 0 byte file left on the TEMP directory. The semaphore cannot be cleaned properly if the server crashes (abnormally shuts down). They remain in the system until the next reboot

Old KB# 26701

#VisiBrokerforC
#Security
#LIOP
#VisiBroker