This problem was found by Wanjun Wang (WebSphere Portal SVT) on RedHat 7 using STAF V3.4.26. He has Perl scripts that submit local STAF service requests, e.g. system("staf local ping ping"). These Perl scripts run fine unless executed through CGI and then they fail with:
Error registering with STAF, RC: 21
CGI runs as the apache user.
He can manually run fine as follows: sudo -u apache perl
But it fails with run via CGI as the apache user.
C:\>STAF local HELP ERROR 21 Response -------- Description: STAF not running Details : This indicates that STAFProc is not running on the local machine with the same STAF_INSTANCE_NAME (and/or the same STAF_TEMP_DIR if on a Unix machine). Notes: 1. If the STAF_INSTANCE_NAME environment variable is not set, it defaults to "STAF". 2. On Unix, if the STAF_TEMP_DIR environment variable is not set, it defaults to "/tmp". This environment variable is not used on Windows. 3. This error can also occur when submitting a request using the local IPC interface on a Unix machine if the socket file that the local interface uses has been inadvertently deleted. 4. To get more information on this error, set special environment variable STAF_DEBUG_21=1 and resubmit your local STAF service request. 3:39:41 PM: Is the STAF_INSTANCE_NAME variable and/or STAF_TEMP_DIR variable set in the environment that it is running in in CGI?
Neither the STAF_INSTANCE_NAME or STAF_TEMP_DIR environment variables are set in his environment. This means that STAF writes its socket file (used by the STAF local IPC interface) to /tmp.
Wanjun discovered that CGI doesn't allow writing to /tmp. He solved the problem by disabling PrivateTmp for httpd service. It's a new security feature in Red Hat Enterprise Linux (RHEL) 7 talked about at https://access.redhat.com/blogs/766093/posts/1976243 (and other places found by googling).
This bug is to update the STAF FAQ documentation and/or the help text for RC 21.
Diff: