Kbase P32064: Session can stay active after APPLY CLOSE TO THIS-PROCEDURE.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  19/12/2008 |
|
Status: Verified
SYMPTOM(s):
Session can stay active after APPLY CLOSE TO THIS-PROCEDURE.
Session remains active when program which can be run interactively (with an interface) is run in a non-interactive mode.
Procedure is run non-persistent when run non-interactive.
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
CAUSE:
Often, procedures contain default code that activates a WAIT-FOR when being run non-persistently (for example, the templates for UI procedures supplied by Progress).
Usually the CLOSE event has a trigger attached that deletes the procedure receiving the event if run persistently.
When such a procedure is to be run without user interaction, what commonly happens is this:
An APPLY 'CLOSE' TO THIS procedure is included to end the program. This will be located before the WAIT-FOR.
What this case is that a CLOSE event is fired before the WAIT-FOR in the main block is started.
However, as this is a non-persistent procedure it cannot be deleted and processing will continue. When processing reaches the WAIT-FOR statement the procedure will get stuck on it and the session will hang.
FIX:
As a guideline, a non-interactive program should be considered incapable of handling events (the most notable exception being socket server processes). Therefore avoid using WAIT-FOR's when a procedure is run in a non-interactive fashion.
There are several ways to achieve this:
1) Ensure the procedure is run persistently. This avoids the wait-for condition, and assuming the ON CLOSE trigger is set up properly will allow the APPLY CLOSE to clean up the procedure properly.
2) Instead of relying on APPLY CLOSE, use the RETURN to signal the end of the procedure. Note that this will only work if the non-interactive code is located in the procedure's main block.
3) Split off the functionality that is to be run both interactively and non-interactively. Then use different procedures to call the functionality for the different operating modes.