HP OpenVMS Systemsask the wizard |
The Question is: I have a program that spawns processes using the sys$spawn routine with the NOWAIT flag. On one system when the fourth concurrent process is spawned it returns immediately with no error, and no lines of code are execute in the spawned program. As no error is returned, but the program is not run I'm at a loss were to look next for the problem. code: static spawn_server(comstr, port, requested_server) char *comstr; int port; char *requested_server; struct DESCRIPTOR desc; struct DESCRIPTOR inputdesc; struct DESCRIPTOR outputdesc; unsigned int rc; int flags; int spawn_astadr(); desc.len = strlen(comstr); desc.type = FIXED_LENGTH; desc.text = comstr; outputdesc.len = 3; outputdesc.type = FIXED_LENGTH; outputdesc.text = "NL:"; inputdesc.len = 3; inputdesc.type = FIXED_LENGTH; inputdesc.text = "NL:"; flags = 1; vms_tt_close(); rc = lib$spawn(&desc, /* command-string */ &inputdesc, /* input-file */ &outputdesc, /* output-file */ &flags, /* flags (NOWAIT) */ 0, /* process name */ 0, /* process id */ 0, /* completion status */ 0, /* completion efn */ spawn_astadr, /* completion astadr */ port); /* completion astprm */ vms_tt_open(); if (isodd(rc)) { sprintf(buf, "Server process spawned - %d,%d", rc, ERRNO); rsi_logmsg("[spawn_server]", buf); } else { sprintf(buf, "failed to spawn server, return code = %d, errno = %d",rc,ERRNO); rsi_logmsg("[spawn_server]", buf); return(-1); } return(1); static spawn_astadr(port) int port; The Answer is : Please read and heed the suggestions in topic (1661). As applied here, that includes the specification of the completion status argument on the lib$spawn call, a full and complete specification of the quota array argument for the created subprocess (also please see topic (5945) and the OpenVMS FAQ for related details on [no]member_alignment as is necessary with the quota array), and explicitly checking the return status from every call -- including the return status from the lib$spawn call -- using the macros defined in stsdef.h or any equivilent technique that matches on the severity field or (when specifically required) on an explicit status code. (This status check may be what you are doing with your isodd() call, the related code was not included.) You may also want to specify a process name (for the subprocess) that is unique, but is also specific to your application. For details on the failing process -- if the subprocess gets created -- you can check the OpenVMS accounting and auditing logs. (This check is made easier if you acquire and track the PID created by the lib$spawn call.) You will of course want to investigate if the lib$spawn is required. As there are no details on the command that is spawned, no specific APIs or alternatives can be provided. Also please review the NOCLI information in the OpenVMS FAQ -- you will need to have a command line interpreter (CLI) present in the process for the lib$spawn to function.
|