When a lock wait timeout occurs on the AppServer, due to a lock conflict that lasted too long (see -lkwtmo startup parameter to change default of 30 minutes), a STOP condition is raised on the client side.
We cannot trap this stop condition by checking ERROR-STATUS:ERROR next to a RUN MyProc ON SERVER NO-ERROR. The only way to handle this situation is to use the ON STOP phrase, as illustrated below:
RUN testlkwtmo.
MESSAGE RETURN-VALUE
VIEW-AS ALERT-BOX INFO BUTTONS OK.
PROCEDURE testlkwtmo:
DEFINE VARIABLE flag AS LOGICAL NO-UNDO.
DEFINE VAR sh AS WIDGET-HANDLE. /* Server handle */
DO ON STOP UNDO, RETURN "STOP occurred":
CREATE SERVER sh.
sh:CONNECT("-AppService lto -H localhost").
RUN AS.p ON SERVER sh (OUTPUT flag) NO-ERROR.
MESSAGE "flag :" flag SKIP
"ERROR-STATUS:ERROR :" ERROR-STATUS:ERROR
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
END PROCEDURE.
If as.p is terminated on the AppServer because of a lock wait time out, a STOP condition proliferated to the client. The flow of the program never reaches the message after the RUN statement, however the calling program will catch the STOP condition handle the RETURN-VALUE.