The following paragraphs describe some common problems that may be encountered with PI API programs when buffering is turned on. The descriptive text identifies the condition that may be indicated by program performance, one or more error messages found in the log file, or from logged error codes.
Verify that the buffer file directory and the APIBUF_[servername].DAT file (and APIBUF_[servername]_####.DAT files on UNIX platforms) are writable by the offending process. The buffer file directory is specified by the FILEBUFPATH parameter in piclient.ini. If not explicitly set, the default directory is used. For details, refer to the desciption of the FILEBUFPATH parameter in "Configuring Buffering using bufserv".
Check file and directory permissions as described above. Under certain conditions, an earlier startup failure can generate a zero length APIBUF_[servername].DAT file or APIBUF_[servername]_####.DAT files. Such files are invalid and will defeat startup. The file should be 16 bytes (the header data) or larger if present. If you find a zero length buffer file, stop any PI API programs running, remove the zero length file, run bufutil -u to unlock any locked resources and restart the buffer server and associated processes.
This occurs when buffering has been indicated in the piclient.ini file but the buffering process, bufserv, was not started before other PI API applications which make connections. Stop the program. Start the buffering process and retry the program that was hanging. Alternately change the piclient.ini file to turn buffering off and retry the program.
You can detect that the process has exited by searching for it in the process list. Under UNIX, use
ps -ef | grep bufserv
Under Windows, double click on the background to bring up the task list and look for the bufserv process. Also check the log file for messages about inability to create buffers. The solution is generally to stop any other PI API programs if they are running and run bufutil -u to unlock the resources. Then when bufserv is started again it should be able to create the resources. However if the problem persists, the choices are to reboot the interface node or rename the shared memory resources (see the bottom of this page).
This is typically the same condition as "PI API programs hang on UNIX" above. The resources have not been created and bufutil, a PI API program, is patiently waiting for the resources to become available. This problem can also occur if a program which had these resources locked has abnormally terminated. In this case, stop all PI API programs, run bufutil -u to unlock the resources, restart bufserv and retry bufutil.
This condition usually indicates that the buffering resources are currently locked by another process. Waiting a few moments is advisable to allow the process to release its locks when it is done accessing the shared resources. If the hang continues, it is likely that a program has abnormally terminated while holding a lock on these resources. Stop all PI API programs, run bufutil -u, restart bufserv, and retry bufutil.
Stop all PI API applications, stopping the buffer server last. On UNIX run pistop. Run bufutil -u. If problems persist in UNIX, become root ("su") and run bufutil -u again. Then run pistart (UNIX) or restart bufserv (Windows).
The buffer full error, -170, may indicate that a program attempted to insert an array of events bigger than the memory buffer can hold. By default, the buffer server uses 32768 bytes of shared memory for each of the memory buffers. This allows approximately 1200 events maximum per putsnapshot call. Increase the memory buffer sizes using the BUF1SIZE and BUF2SIZE entries in piclient.ini.
Stop all PI API applications, stopping the buffer server last. Run bufutil -u. Then restart bufserv.
If the problem persists, two choices remain:
a) Reboot the Interface node.
b) Rename the shared memory objects by editing the piclient.ini file, adding the following lines, then restarting the buffer server and associated processes:
For more information about these parameters, refer to the descriptions in "Configuring Buffering using bufserv".