Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

Implicitly created temp-table not deleted when returning with an error from called procedure

« Go Back

Information

 
Article Number000090732
EnvironmentProduct: OpenEdge
Version: 11.7x
Platform: All supported platforms
Question/Problem Description

When a temp-table handle is passed to an internal procedure a new implicit temp-table is created inside the called procedure.

The implicitly created temp-table is not deleted If a called procedure returns an error(having the cleanup code in FINALLY block). Due to this memory leaks occur.

In client logging, the temp-table handle is created in session pool and remain in delete pending state till the time session ends.
 

Steps to ReproduceDEFINE TEMP-TABLE ttTest NO-UNDO
FIELD cValue AS CHARACTER.

DEFINE VARIABLE hTable AS HANDLE NO-UNDO.

ASSIGN hTable = TEMP-TABLE ttTest:HANDLE.
MESSAGE "initial hTable:" hTable hTable:DEFAULT-BUFFER-HANDLE.

RUN doTableLogic(INPUT-OUTPUT TABLE-HANDLE hTable, INPUT TRUE) NO-ERROR.
IF ERROR-STATUS:ERROR
THEN MESSAGE "doTableLogic error:" RETURN-VALUE.

RUN scanleaks(INPUT SESSION:FIRST-BUFFER).

PROCEDURE doTableLogic:
DEFINE INPUT-OUTPUT PARAMETER TABLE-HANDLE iphTTBuffer.
DEFINE INPUT PARAMETER iplReturnError AS LOGICAL NO-UNDO.

MESSAGE "iphTTBuffer:" iphTTBuffer.

IF iplReturnError THEN
RETURN ERROR "sorry".

FINALLY:
/* delete the implicit created TT */
IF VALID-HANDLE(iphTTBuffer) THEN
DELETE OBJECT iphTTBuffer.
END FINALLY.
END.

PROCEDURE scanLeaks:
DEFINE INPUT PARAMETER iphHandle AS HANDLE NO-UNDO.

IF VALID-HANDLE(iphHandle) THEN
DO:
MESSAGE "Handle Leak" iphHandle iphHandle:TABLE-HANDLE iphHandle:NAME.

/* recurse to find all */
RUN scanLeaks(INPUT iphHandle:NEXT-SIBLING).

/* clean up */
DELETE OBJECT iphHandle:TABLE-HANDLE.
END.
END.
Clarifying Information
When a code is running persistently i.e. the widget-pool will only be cleaned up when the agent is shut down. If called a procedure multiple times and it returns with an error, it will simply keep those handles in memory and consume memory unnecessarily. 
Error Message
Defect/Enhancement NumberDefect OCTA-7459
Cause
The exact cause is not known at this time.
Resolution
None at this time.
Workaround
Notes
Attachment
Last Modified Date8/19/2019 6:34 AM