Setting Shared Memory Queue Size

This article was written for version 2.0.9 of Core. Click here for the most recent version of the help center.

The PolySync Shared Memory API provides an interface to shared memory IO utilities. In Linux, this is an implementation similar to POSIX message queues.

Standard system resource limits can be checked using the ‘ipcs -l’ command.

To increase limits for a queue storing up to 5 image frames of size 640x480x3, set sysctl.conf settings:

sysctl -w kernel.msgmax=4608000
sysctl -w kernel.msgmnb=4608000

If the queue size (4608000 above) is insufficient, the PolySync Dynamic Driver interface will indicate with the following errors:

$ polysync-core-dynamic-driver -n 5 
2016-09-22 12:36:52.09s DEBUG  [video-device-] - build version 2.0.7-1470511976
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - created participant - GUID: 0x0006000572AD58D2 d(1688873259063506)
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - message types visible to this node: 42
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - transition to state: INIT - timestamp: 1474573013356533
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - initializing replay clock
2016-09-22 12:36:53.09s ERROR  [video-device-1688873259063506] - failed to set queue size - Operation not permitted
2016-09-22 12:36:53.09s ERROR  [video-device-1688873259063506] - failed to create shared memory queue with key: 4 - size: 6144000 bytes - check Shared Memory API documentation for system resource configurations
2016-09-22 12:36:53.09s ERROR  [video-device-1688873259063506] - failed to validate interface - check sensor connection if connected, SDF and system configurations, and manager node status
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - activate fault - dtc_code: 308
2016-09-22 12:36:53.09s DEBUG  [video-device-1688873259063506] - transition to state: ERROR - timestamp: 1474573013607427
2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to set queue size - Operation not permitted
2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to create shared memory queue with key: 4 - size: 6144000 bytes - check Shared Memory API documentation for system resource configurations
2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to set queue size - Operation not permitted
2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to create shared memory queue with key: 4 - size: 6144000 bytes - check Shared Memory API documentation for system resource configurations
^C2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to set queue size - Operation not permitted
2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to create shared memory queue with key: 4 - size: 6144000 bytes - check Shared Memory API documentation for system resource configurations
2016-09-22 12:36:54.09s DEBUG  [video-device-1688873259063506] - exit signaled - terminating
2016-09-22 12:36:54.09s DEBUG  [video-device-1688873259063506] - releasing replay clock
2016-09-22 12:36:56.09s DEBUG  [video-device-1688873259063506] - last node registered on the host - deleting shared memory

Within the error and debug messages, there’s a line that indicates specifically how large the queue must be:

2016-09-22 12:36:54.09s ERROR  [video-device-1688873259063506] - failed to create shared memory queue with key: 4 - size: 6144000 bytes - check Shared Memory API documentation for system resource configurations

Use the size─in this case 6144000─to alter the local hosts network configuration:

sysctl -w kernel.msgmax=6144000
sysctl -w kernel.msgmnb=6144000