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




Feedback
Did this article resolve your question/issue?

   

Article

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

« Go Back

Information

 
TitleImplicitly created temp-table not deleted when returning with an error from called procedure
URL NameImplicitly-created-temp-table-not-deleted-when-returning-with-an-error-from-called-procedure
Article Number000118350
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
Last Modified Date8/19/2019 6:34 AM
Attachment 
Files rep-code.p
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.