FairCom ISAM for C

Previous Topic

Next Topic

Unix Communications Notes

Unix client applications can communicate with the FairCom Server through shared memory and take advantage of semaphores. If the FairCom Server terminates, either in a controlled manner with ctstop or non-controlled by an interrupt signal, the FairCom Server releases all shared memory and semaphore resources it was using. Active shared memory and semaphores can be displayed with the Unix ipcs command. See the Unix documentation for more information.

The FairCom Server monitors for the interrupt signal, SIGINT, to execute the necessary clean up. We have discovered that on some Unix platforms this interrupt detection is deactivated during our task switching. The result being that if the FairCom Server terminates in a non-controlled manner (i.e.: the “DEL” key hit) these resources remain active causing error SHND_ERR (143) when the FairCom Server restarts. We suggest the following:

  1. When starting the FairCom Server, submit it to background so a user cannot terminate the FairCom Server by hitting the keyboard. Use the no hang up option in case the terminal logs off. From the command prompt, enter:

    nohup ctsrvr &
  2. If the FairCom Server terminated and left resources active, producing a SHND_ERR error when trying to start, do the following:
    1. Execute ipcs to see the resources. The active shared memory and semaphore ID’s will be displayed.

    2. Execute ipcrm to remove the active resources. The following example of removing shared memory ID 1400, and semaphore ID numbers 140 and 141:

      ipcrm -m 1400 -s 140 -s 141

These numbers are from ipcs. An ID value of zero is valid, and should be included in the ipcrm command. Check the owner and group indicators when displaying these resources. You do not want to remove any not belonging to the FairCom Server.

If the FairCom Server is not running, there should be no files in /tmp/ctreedbs. Remove any files found in /tmp/ctreedbs before restarting the FairCom Server. This path can be changed for the server with server keyword SHMEM_DIRECTORY. For the client side, see Shared Memory Client-Server Communication for Unix/Linux in the FairCom DB Administrator's Guide.